How to working database connection

Posted by Sathyavaradharaj under C# on 10/22/2010 | Points: 10 | Views : 1987 | Status : [Member] | Replies : 8
how to using the datagrid control to db accessing




Responses

Posted by: Varshavmane on: 10/22/2010 [Member] Starter | Points: 25

Up
0
Down
Hello,
You want to show Data from Database to Datagrid??

Check this:

http://www.c-sharpcorner.com/UploadFile/mahesh/DataGrid11282005234057PM/DataGrid.aspx

HTH.

Sathyavaradharaj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: T.saravanan on: 10/22/2010 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi Sathya,

Which application you can use Windows (or) Web?

Windows Application:
http://msdn.microsoft.com/en-us/library/fbk67b6z.aspx

Web Application:
http://msdn.microsoft.com/en-us/library/aa728895%28VS.71%29.aspx
http://msdn.microsoft.com/en-us/library/ms972948.aspx

Refer those links its will helpful to you.

Cheers :)

Thanks,
T.Saravanan

Sathyavaradharaj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sathyavaradharaj on: 10/23/2010 [Member] Starter | Points: 25

Up
0
Down
Data grid control using sql server

Sathyavaradharaj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: T.saravanan on: 10/23/2010 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi SathyaVaradharaj,

Data grid control using sql server means are you fetch the data from Database or DataGridView to Database.
Ask your question briefly or what's your problem then only viewer can understand the question and give the solution.






Thanks,
T.Saravanan

Sathyavaradharaj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chvrsri on: 10/25/2010 [Member] [Moderator] [MVP] Silver | Points: 25

Up
0
Down
Hi satya your question is not so clear but iam explaining how far i understood.
Use this code to connect to database using Datagrid...This explains bringing the data from the database
and binding it to your DataGrid...!!! Hope it helps for your cause.

//add this namespace

using System.SqlClient;

SqlConnection con;
int abc= 0;
con = new SqlConnection("server=SERVER-NAME;user id=USERNAME;password=PASSWORD;database=DBNAME");
con.Open();
SqlCommand cmd;
SqlDataReader rdr;
cmd = new SqlCommand("Your Command",con);
rdr=cmd.ExecuteReader();
datagridID.DataSource()=rdr;
datagrid.DataBind();


Thanks,
Radha Srikanth

Sathyavaradharaj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sathyavaradharaj on: 10/25/2010 [Member] Starter | Points: 25

Up
0
Down
Ok Thanks

Sathyavaradharaj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chvrsri on: 10/25/2010 [Member] [Moderator] [MVP] Silver | Points: 25

Up
0
Down
If u really feel that the info given fetched ur answer mark it as ANSWER.....

Thanks,
Radha Srikanth

Sathyavaradharaj, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response