TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Israel
692
1.3k
219.3k
trying to read code from my textbox... Doesnt
Sep 5 2014 11:32 PM
Hi!
I wrote these to try to read the data that appear on the textbox when the barcode reader is pointed on a barcode book for example. But its doesnt. Anyone can explain please.
private void codigoBarraConsStocks_KeyPress(object sender, KeyPressEventArgs e)
{
string connectionString = @"Data Source=localhost\sqlexpress;Initial Catalog=master;Integrated Security=True";
SqlConnection sqlCon = new SqlConnection(connectionString);
sqlCon.Open();
string commandString = "select * from consultoria where codigobarra ='" + codigoBarraConsStocks.Text + "'";
SqlCommand sqlCmd = new SqlCommand(commandString, sqlCon);
SqlDataReader read = sqlCmd.ExecuteReader();
if (read.HasRows)
{
while (read.Read())
{
codigoBarraStocks.Text = read["codigobarra"].ToString(); // it will show the code
produtoStocks.Text = read["produto"].ToString(); // it will show the code
precoStocks.Text = read["preco"].ToString(); // it will show the code
nStocksStocks.Text = read["n_stocks"].ToString(); // it will show the code
}
}
else
{
MessageBox.Show("A record with a code of " + codigoBarraConsStocks.Text + " was not found");
}
read.Close();
sqlCon.Close();
}
Reply
Answers (
7
)
Please just a quick help on my server path
Web Scraping