Hi!
I am doing a simple filter after that my records should appear on textboxs I choose. But its appear only on the one I colored on blue (other one not. Why?)
I thought that its was the type of the "stocks" column. Before its was type="numeric" . I change to "nchar". But Still giving me this error "IndexOutOfRangeException was unhandle".
private void btnProcurarProdutoCons_Click(object sender, EventArgs e)
{
string connectionString = @"Data Source=localhost\sqlexpress;Initial Catalog=master;Integrated Security=True";
SqlConnection sqlCon = new SqlConnection(connectionString);
sqlCon.Open();
string commandString = "select produto from consultoria where produto='" + nomeProdutoConsStocks.Text + "'";
SqlCommand sqlCmd = new SqlCommand(commandString, sqlCon);
SqlDataReader read = sqlCmd.ExecuteReader();
while (read.Read())
{
produtoStocks.Text = read["produto"].ToString();// Here its appear
nStocksStocks.Text = read["n_stocks"].ToString();//Here its not appear
}
sqlCon.Close();
}
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Apr 29, 2014, 11:37 AM
IsraelPosted Apr 29, 2014, 12:09 PM