can someone please check my code because it doesnt update my database.. i set the room no. as the primary key.. can you please help, its urgent.. i need it tomorrow.. thanks.
Dim con As New OleDb.OleDbConnection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=..\data\YayaDB.mdb"
con.Open()
Dim query = "UPDATE Rooms SET Rooms.Customer_Name = @Name, Rooms.CheckIn_Date = @Date, Rooms.Time_In = @TimeIn, Rooms.Time_Out = @TimeOut, Rooms.Price = @Price WHERE Rooms.Room = @RoomNo"
Dim cmd = New OleDbCommand(query, con)
cmd.Connection = con
cmd.Parameters.AddWithValue("@RoomNo", txtRoom.Text)
cmd.Parameters.AddWithValue("@Name", txtName.Text)
cmd.Parameters.AddWithValue("@Date", txtDate.Text)
cmd.Parameters.AddWithValue("@TimeIn", txtTimeIn.Text)
cmd.Parameters.AddWithValue("@TimeOut", txtTimeOut.Text)
cmd.Parameters.AddWithValue("@Price", txtPrice.Text)
cmd.ExecuteNonQuery()
con.Close()