hi sir,
i have vb.net project connected with msaccess ,in that when i inserting a value to one table i want to update the value in another table is it possible ,in my code it is not showing any error but it is not updating only inserting can u check my code and correct it this is my code
CONNECT()
CMD = New OleDbCommand("SELECT * FROM SOLDOUTITEM WHERE ITEM_NO='" & TextBox1.Text & "'", CON)
DR = CMD.ExecuteReader
If DR.Read Then
MsgBox("ITEM NO ALREADY EXISTING", MsgBoxStyle.OkOnly, "INFORMATION")
clear()
Else
CMD = New OleDbCommand("INSERT INTO SOLDOUTITEM VALUES('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & DateTimePicker1.Value & "','" & TextBox6.Text & "','" & TextBox7.Text & "','" & TextBox8.Text & "','" & TextBox9.Text & "','" & TextBox10.Text & "','" & TextBox11.Text & "','" & Label13.Text & "')", CON)
CMD.ExecuteNonQuery()
S = "SOLDOUT"
CMD1 = New OleDbCommand("UPDATE NEWITEM SET ITEM_STATUS='" + S + "' WHERE ITEM_NO='" & TextBox1.Text & "'", CON)
CMD1.ExecuteNonQuery()
MsgBox("ITEM ADDED SUCCESSFULLY", MsgBoxStyle.OkOnly, "NEW ITEM")
clear()
End If
CON.Close()
CONNECT()
CMD = New OleDbCommand("SELECT * FROM SOLDOUTITEM WHERE ITEM_NO='" & TextBox1.Text & "'", CON)
DR = CMD.ExecuteReader
If DR.Read Then
MsgBox("ITEM NO ALREADY EXISTING", MsgBoxStyle.OkOnly, "INFORMATION")
clear()
Else
CMD = New OleDbCommand("INSERT INTO SOLDOUTITEM VALUES('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & DateTimePicker1.Value & "','" & TextBox6.Text & "','" & TextBox7.Text & "','" & TextBox8.Text & "','" & TextBox9.Text & "','" & TextBox10.Text & "','" & TextBox11.Text & "','" & Label13.Text & "')", CON)
CMD.ExecuteNonQuery()
S = "SOLDOUT"
CMD1 = New OleDbCommand("UPDATE NEWITEM SET ITEM_STATUS='" + S + "' WHERE ITEM_NO='" & TextBox1.Text & "'", CON)
CMD1.ExecuteNonQuery()
MsgBox("ITEM ADDED SUCCESSFULLY", MsgBoxStyle.OkOnly, "NEW ITEM")
clear()
End If
CON.Close()