Click here to Skip to main content
15,849,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all!

i create a procedure in sql server 2008 and has parameter


and i have to retrive from that procedure fname, mname, lname

procedure is working properly but i am confiused to how to write this in c sharp
to display my data from sql server to a datagridview in c sharp

how to do

1 solution

Try using Google. Key word is ADO.Net.

You can also see the following examples, but its important that you have a basic understanding of ADO.Net.

How to populate DataGridView, GridView with SQL statement in C#[^][^][^]
Share this answer
kami124 22-Aug-11 4:05am    
here is my function but still i am confuse how to do this form procedure before i done tis simple querry

public static void FillDataInGridView_umrf(string proc_mod,int mrf, DataGridView dg1)
string sql_string = ("Data Source=345jk5jh5kjh;Initial Catalog=fgsdfgdfg;User Id=ertertd;Password=dfgdfgdfg;");
SqlConnection conn = new SqlConnection(sql_string);
SqlCommand command = new SqlCommand(proc_mod, conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@mrfid", mrf);
SqlDataAdapter a = new SqlDataAdapter(proc_mod, conn);
DataTable t = new DataTable();
dg1.DataSource = t;
walterhevedeich 22-Aug-11 4:33am    
Its basically the same, only this time, you will need to provide the name of the SP, rather than the query. As I said, having a basic understanding of the concept is important. What part exactly are you having problems?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900