Click here to Skip to main content
16,018,249 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,
I want to retrieve a single row from mysql database table,which match the condition. i have a stored procedure.
Eg. get all columns from user_table for a particular user that is search with username
Please help me.

Thanks in Advance.
Posted
Updated 5-Jul-11 18:59pm
v2

Make your stored proc return what you want it to, don't process stuff in code. Your function can return anything you want. In fact, your question makes no sense. Why CAN'T you return a single row ?
 
Share this answer
 
If you mean you want to cast a MySqlDataReader to a DataRow, I dont think this is possible. You may, however, want to put the values of the data reader to an array or a collection, depends on your situation. Hope this example helps

C#
while (reader.Read())
{
   if (reader["user_name"] == "SoAndSo")
   {
      for(int i = 0; i < reader.FieldCount; i++)
      {
         myArray[i] = reader[i]; //I only used array as an example but you may use built in collections.
      }
      break;
   }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900