Hallo
Hope somebody can assist, I can get the SQL data into a datagrid, but for some reason I cannot figure out how to get this value into a simple variable or textbox, I do a lookup in a table and there will always just be one value.
Only trying to get the Chute Nr into a text box..
try
{
conn.Open();
cmd = new SqlCommand("SELECT ChuteNr FROM [STOREDETAILS] where StoreBarcode like @Barcode", conn);
cmd.Parameters.AddWithValue("@Barcode", GetBoxCode().ToString());
sda = new SqlDataAdapter(cmd);
dt = new DataTable();
sda.Fill(dt);
this.dgSQLData.DataSource = dt;
this.txtSideCode.Text = dt[ "ChuteNr" ].ToString();
RowCount = this.dgSQLData.RowCount;
StatusBits[0] = false;
this.txtSQLStatusBar.Text = "Searching Data";
}
catch (Exception ex)
{
StatusBits[0] = true;
MessageBox.Show(ex.ToString());
this.txtSQLStatusBar.Text = "SQL Connection Error reading Code";
}
finally
{
conn.Close();
RowCount = RowCount + 1;
this.txtRecordCount.Text = Convert.ToString(RowCount);
}labjac