public gettestdata GetInfo() { gettestdata g = new gettestdata(); SqlConnection con = new SqlConnection("Data Source=LAPTOP-E77BQ7S0;Initial Catalog=WcfService2;User ID=sa;Password=123;Pooling=False"); con.Open(); SqlCommand cmd = new SqlCommand("Select * from UserTab", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable("table"); da.Fill(dt); g.table = dt; return(g); }
public gettestdata GetInfo() { gettestdata g = new gettestdata(); SqlConnection con = new SqlConnection("Data Source=DESKTOP-M66THJ5;Initial Catalog=MyTestDB;Persist Security Info=True;User ID=sa;Password=12345;Pooling=False"); con.Open(); SqlCommand cmd = new SqlCommand("Select * from UserTab", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); g.usertab = dt; return(g); }