|
-
May 3rd, 2010, 02:59 AM
#1
how to show data in gridview from two tables
Dear Seniours,
Please guide me how can i show data in a single gridview from two tables in windows forms.
-
May 3rd, 2010, 03:16 AM
#2
Re: how to show data in gridview from two tables
Just to clarify, are the two tables linked using Primary / Foreign keys or are they completely unrelated?
-
May 3rd, 2010, 05:55 AM
#3
Re: how to show data in gridview from two tables
Yes Sir both tables are liked primary-foreign key.
i am trying this code to show my gridview after join operation but i am unable to write correct code please help me out.
SqlConnection con = new SqlConnection("Data Source=TSARavi\\SQL2005,1435;Initial Catalog=TestDB;User ID=testdb;Password=testdb1");
con.Open();
string query = "SELECT Users.UserName, Users.UserPassword, UsersDetails.fullName,UsersDetails.qualification,UsersDetails.Address FROM Users INNER JOIN UsersDetails ON Users.UserID =UsersDetails.UserID ORDER BY UsersDetails.fullName";
SqlCommand cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery();
con.Close();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|