7
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by sivananda2009
0

please help me. tell me how to show a table from sql database by button click event in my form

I would recommend using a grid view
0

in page load or button click event
{
string="select * from xxx";
DataAdapter Da=new DataAdapter(string,con);
DataSet Ds= new DataSet();
Da.Fill(Ds,"xxx") ; //xxx means table name

Gridview1.DataSource=Ds.Tables["xxx"];
Gridview1.DataBind();
}

0

U can use the grid view for this.
bind it to the database which has ur table. add the project data source.
u can do all these in arnd 3 mins...

0

hey , dis is not working wen i use it with mysql database so help me for mysql database

0

before suryasasidhar's code are you check your connection string.
if not then need to define connection string.

Edited by prashant144: added

0

there are a great many tutorials on how to work with datagrid's and external data sources: tutorials.

If you get stuck with a specific problem you can start a specific thread to get help :)

Remember to mark the thread as solved

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.