question about mysql and c#
#1

hello,

 

i am coding a tool and i would like how to get records from a table.

 

i have been "googling" and i have found this structure:

 

 

SqlConnection sqlconn = 2 SqlConnection(connectionStr);
SqlCommand sqlcomm = 2 SqlCommand("SELECT * FROM OrderDetail", sqlconn);
SqlDataReader reader = sqlcomm.ExecuteReader();

const int UNITPRICE = 0;
const int QUANTITY = 1;

while (reader.Read())
{
    float unitPrice = reader.getFloat(UNITPRICE);
    int quantity = reader.getInt(QUANTITY);

    // Do whatever with the values.
}

reader.Dispose();
sqlcomm.Dispose();
sqlconn.Dispose();

 

but i dont know if it works and of course, i wouldnt like to work on it and finally, it doesnt work. so i would like you could help me.

 

thanks in advance.

 

P.S. if there is another method easier than i have found, please tell me or if this method is good and i have to modify it tell me too please



Messages In This Thread
[No subject] - by soryjero - 07-08-2013, 01:03 PM
[No subject] - by someone - 07-08-2013, 05:23 PM
[No subject] - by Wizatek - 07-08-2013, 06:52 PM
[No subject] - by soryjero - 07-08-2013, 10:03 PM
[No subject] - by soryjero - 07-09-2013, 09:58 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)