how to display values from database tables without using datagrid control in C# .net.I want to search the values from database & the search results to be shown as rows in the web form,without the use of datagrid.So any one plz help me.
how to display values from database tables without using datagrid control
Collapse
X
-
Originally posted by nmsreddihi
can u post your query more specific
you just want to avoid datagrid or you dont want to go for any other control like label...or u want to print directly on the web form what actually is your problem
bye
I want to knw,
how to retrieve multiple records from SQL tables using MYSQL data connecter/net and display in html tables without using any data grid. Idon't know how to use the EOF file feature of data set to retrieve the records
Plz help meComment
-
Originally posted by neenaHi
I want to knw,
how to retrieve multiple records from SQL tables using MYSQL data connecter/net and display in html tables without using any data grid. Idon't know how to use the EOF file feature of data set to retrieve the records
Plz help me
If u don't wants to use grid, the u have to use Table. u have to assign each column value to each cell with the help of loop.
MaheshComment
-
Originally posted by Mahesh_BoteIf u don't wants to use grid, the u have to use Table. u have to assign each column value to each cell with the help of loop.
Mahesh
thanks for the reply.But i am still in doubt :confused:
I want to display the search results in table as rows (like the gmail or yahoo mailbox).I attached my code here.Can i use any array?but i dont know how to apply it here. otherwise for each table row i have to write the code.& it becomes very bulky rt?
So is there any other way?plz help me by giving ur suggestions.
private void Go_Button_Click (object sender, System.EventArg s e)
{
MySqlConnection myConnection=ne w MySqlConnection (
"server=localho st; userid=root; password=passwo rd;database=sal es;pooling=fals e;");
String strSql;
strSql="SELECT name,country,we bsite FROM accounts WHERE name= '" + TxtSearch.Text+ "' AND id='"+Label1.Te xt+ "'";
MySqlCommand cmd=new MySqlCommand(st rSql,myConnecti on);
MySqlDataAdapte r myAdapter=new MySqlDataAdapte r(strSql,myConn ection);
DataSet sales=new DataSet();
myConnection.Op en();
myAdapter.Fill( sales,"accounts ");
MySqlDataReader reader;
foreach(DataRow dr in sales.Tables["accounts"].Rows)
{
reader=cmd.Exec uteReader();
reader.Read();
LBL_NAME1.Text= reader["name"].ToString();
LBL_CNTRY1.Text =reader["country"].ToString();
LBL_WEB1.Text=r eader["website"].ToString();
LBL_NAME2.Text= reader["name"].ToString();
LBL_CNTRY2.Text =reader["country"].ToString();
LBL_WEB2.Text=r eader["website"].ToString();
reader.Close();
}
}Comment
Comment