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
Mfwamba Tshimanga
NA
155
46.1k
Cannot update records...
Jul 19 2014 2:07 PM
Hi!
Why I cannot update my record on my database. I receive this message (
not saved
). Please have a look on my codes to see if somethink is wrong.
private void btnUpdate_ProdutoStock_Click(object sender, EventArgs e)
{
{
conn = new SqlConnection(connstr);
comm = new SqlCommand();
conn.Open();
SqlParameter code = new SqlParameter("@cod", SqlDbType.VarChar);
SqlParameter product = new SqlParameter("@prod", SqlDbType.NChar);
SqlParameter price = new SqlParameter("@price", SqlDbType.NChar);
SqlParameter n_stock = new SqlParameter("@stock", SqlDbType.NChar);
comm.Parameters.Add(code );
comm.Parameters.Add(product );
comm.Parameters.Add(price );
comm.Parameters.Add(n_stock);
code .Value = codigoBarraStocks.Text;
product .Value = produtoStocks.Text;
price .Value = precoStocks.Text;
n_stock.Value = nStocksStocks.Text;
comm.Connection = conn;
comm.CommandText ="UPDATE consult SET code = @cod, product= @prod, price = @preco, n_stock= @stock WHERE (code = @cod)";
try
{
comm.ExecuteNonQuery();
MessageBox.Show("Saved");
}
catch (Exception)
{
MessageBox.Show("Not saved");
}
finally
{
conn.Close();
}
}
}
}
}
Reply
Answers (
1
)
What are the characters are not allowed in url..?
Dropdownlist