hi,
i want to know the index of row( i know the primary key column value, based on that i want to know the index of that row in data table)
here is my code i tried:
but it's giving error as:table doesn't have a primary key. c#
But my datatable in Mysql database is having primary key column.
here startNo=1002 and endNo=1005
which i have in database primary key values
i want to know the index of row( i know the primary key column value, based on that i want to know the index of that row in data table)
here is my code i tried:
but it's giving error as:table doesn't have a primary key. c#
But my datatable in Mysql database is having primary key column.
Code:
using (MySqlConnection con = new MySqlConnection(ConnectionString))
{
String query = "select * from customer";
MySqlCommand command = new MySqlCommand(query, con);
MySqlDataAdapter da = new MySqlDataAdapter(query, con);
da.Fill(dt1);
totalRowsInDB = dt1.Rows.Count;
Startindex = dt1.Rows.IndexOf(dt1.Rows.Find(startNo));
Endindex = dt1.Rows.IndexOf(dt1.Rows.Find(endNo));
con.Open();
which i have in database primary key values
Comment