Click here to Skip to main content
16,020,447 members

Comments by Pallavi 24 (Top 9 by date)

Pallavi 24 3-Mar-17 9:52am View    
I did not use connection string.Actually modified ur code and I used following code:
SqlCommand cmd= con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText="UPDATE Books SET Quantity = Quantity + @QT WHERE Name = @NM AND Author = @AU";
cmd.Parameters.AddWithValue("@QT", qty);
cmd.Parameters.AddWithValue("@NM", txtBookName.Text);
cmd.Parameters.AddWithValue("@AU", txtBookAuthor.Text);
cmd.ExecuteNonQuery();
MessageBox.Show("Updated successfully");
con.Close();
Pallavi 24 3-Mar-17 9:22am View    
Thank you so much. I made changes and it is working now perfectly.
Pallavi 24 3-Mar-17 9:10am View    
The ConnectionString property has not been initialized.
I am getting this error.
Pallavi 24 13-Feb-17 5:01am View    
Conversion failed when converting the varchar value 'System.Windows.Forms.DataGridViewSelectedRowCollection' to data type int.
I get the above error when I use Update statement..
I used the below code,.....
cmd.CommandText = "Update IssueBooks set BookStatus='Returned' where IssueId='"+dataGridView1.SelectedRows+"' ";
I have used a grid view. Based on selection that the user does the table has to be updated..
Pallavi 24 8-Feb-17 23:47pm View    
If I create a procedure then how will the procedure be called when the button is called ?