mysql C# select pk and all columns datareader
// Fill orderIDsList with OrderID's
private void btnStart_Click(object sender, System.EventArgs e)
{
int iOrderID;
// Create a command to select the Order IDs from the ORDERS table
SqlCommand command = new SqlCommand
("SELECT OrderID from ORDERS", con);
// Open the connection
con.Open();
// Get the data reader
SqlDataReader reader = command.ExecuteReader();
// Process each result
while (reader.Read())
{
// Add each order ID in the result to the list
// view containing the orders IDs. We have only
// selected a single column in this code so we
// can be pretty save in using reader.GetInit32(0)
// there are no more columns in the data reader.
iOrderID = reader.GetOrdinal("OrderID");
orderIDsList.Items.Add (reader.GetInt32(iOrderID));
}
// Close the reader and the connection
reader.Close();
this.con.Close();
}
Also in C#:
- unity how to get data of play session time in a text file?
- how to convert float to int c#
- get all child gameObject of gameObject C#
- There is already an open DataReader associated with this Command which must be closed first c#
- c# param exception
- c# thread sleep
- c sharp string replace
- conditional compilation c#
- visual c#
- c# how to use inovke
- unity html request
- c# dictionary add
- c# interview questions
- C# copy string except for last letter
- c# constructor
- c# expandoobject indexer
- Request.Form
- unity instantiate vector3
- go to next itiration in foreach C#
- page refresh on button click in c#
- abstract class c#
- how to make error sound c#
- c# loop through array
- c# find where word is contained in a string