如何在没有gridview的情况下表示没有文本框数据的reterive数据
问题描述:
如何从表中重新发送数据并在没有gridview的情况下绑定我确实下拉了我没有文本框和单选按钮:
sql:
how to reterive data from table and bind without gridview i did drop down i don't no textbox and radio button:
sql:
create procedure databinding1 (@resturentname varchar(max))
as
begin
select * from hyd_resturentdetails where resturentname = @resturentname
end
类文件:
class file:
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;
}
答
Hello Vignesh,您已经编写了从数据库中检索数据的代码。
Hello Vignesh, you have already written code to retrieve data from database.
select * from hyd_resturentdetails where resturentname = @resturentname
我假设 hyd_resturentdetails 表有多列。因此,上面的SQL将返回包含此表中所有列的行。因此,GridView将是显示页面上所有详细信息的理想选择。
如果要将检索到的数据绑定到GridView控件,请使用以下代码:
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:
GridView1.DataSource = bind1("resturant_name_to_search");
GridView1.DataBind();
如果您正在寻找其他东西,请告诉我。
- DD
Let me know if you are looking for something else.
- DD