Dear All,
What is wrong with the following code? The source code was put below in accordance with a picture showing the red lines.
TIA
using System;
using System.Data;
using System.Data.SqlClient;
namespace ConnectSql
{
class Program
{
static void Main(string[] args)
{
ConnSql.Connect_Sql();
Console.WriteLine("Hello World!");
}
}
class ConnSql
{
public void Connect_Sql ()
{
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=WelkinDB;Integrated Security=True");
SqlCommand cmd;
DataTable dt;
SqlDataAdapter da;
con.Open();
cmd = new SqlCommand("Select * from student", con);
da = new SqlDataAdapter(cmd);
ds = new DataSet();
da.Fill(ds, "testTable");
con.Close();
dt = ds.Tables["testTable"];
}
}
}