Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to reterive data from table and bind without gridview i did drop down i don't no textbox and radio button:
sql:
SQL
create procedure databinding1 (@resturentname varchar(max))
as
begin
select * from hyd_resturentdetails where resturentname = @resturentname
end

class file:
C#
public DataSet bind1(string s )
    {
        cmd.Connection = con1;
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "databinding1 ";
        cmd.Parameters.AddWithValue("@resturentname", s);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        con1.Open();
        da.Fill(ds);
        con1.Close();
        return ds;
        
    
    }
Posted
Updated 22-Jun-14 3:27am
v2
Comments
Kornfeld Eliyahu Peter 22-Jun-14 9:27am    
Bind to what?

1 solution

Hello Vignesh, you have already written code to retrieve data from database.
SQL
select * from hyd_resturentdetails where resturentname = @resturentname

I assume hyd_resturentdetails table has multiple columns. So, the above SQL is going to return a row with all the columns in this table. Hence, GridView would be an ideal choice to display all the details on page.
If you want to bind the retrieved data to a GridView control, then use the following code:
C#
GridView1.DataSource = bind1("resturant_name_to_search");
GridView1.DataBind();

Let me know if you are looking for something else.
- DD
 
Share this answer
 
Comments
Vignesh Madeshwaran 22-Jun-14 23:03pm    
without gridview i want bind data gridview method i did. thank you for your suggtion
Debabrata_Das 23-Jun-14 2:23am    
Ok, so you want to bind a DataGridView instead of a GridView. Am I correct? If yes, then what is the problem you are facing?
Vignesh Madeshwaran 23-Jun-14 22:28pm    
oki bro i did text box binding i want radio button bind how to bind radio button

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