By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
463,048 Members | 428 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 463,048 IT Pros & Developers. It's quick & easy.

How to store data in table format?

P: 3
Hi every one i want to store data in data table and send that data in xml format to web service after fetching it from sql query can any one help me plz .Here is my code

string username = Request.QueryString["username"];
string password = Request.QueryString["password"];
int response;
string constr = "Data Source=ITS-BA-DC02\\MSSQL2008_SAND;Initial Catalog=TestDB_Chaitanya;User ID=sa;Password=01Explore";
SqlConnection conn = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand("select * from users where username = '" + username + "'and password='" + password + "'", conn);
SqlDataAdapter da = new SqlDataAdapter("select * from users where username = '" + username + "'and password='" + password + "'", conn);
SqlDataReader dr = cmd.ExecuteReader();
DataSet ds = new DataSet();
DataTable dt;
da.Fill(ds, "users");
Dec 21 '11 #1
Share this Question
Share on Google+
1 Reply

Post your reply

Sign in to post your reply or Sign up for a free account.