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

Recommended Answers

All 7 Replies

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

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();
}

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...

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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.