public gettestdata GetInfo() { gettestdata g = new gettestdata(); SqlConnection con = new SqlConnection("Data Source=ARIFBUDIMANAR;Initial Catalog=crudDB;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"); con.Open(); SqlCommand cmd = new SqlCommand("Select*From UserTab", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable("mytab"); da.Fill(dt); g.usertab = dt; return(g); }
public gettestdata GetInfo() { gettestdata g = new gettestdata(); SqlConnection con = new SqlConnection("Data Source=DESKTOP-Q6TINDB; Initial Catalog=WCF;Persist Security Info=True;User ID=sa; Password=123ricki"); con.Open(); SqlCommand cmd = new SqlCommand("Select * from UserTab", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable("mytab"); da.Fill(dt); g.usertab = dt; return(g); }