Error: el número de valores de consulta y los campos de destino no son iguales
Public Class RoomInfo
Dim ValTx As String
Dim ValNr As Integer
Private Sub cboRoomType_DropDown(sender As System.Object, e As System.EventArgs) Handles cboRoomType.DropDown
cboRoomType.Items.Clear()
qry = "select RoomType from tblRoomType"
cmd = New OleDb.OleDbCommand(qry, con)
dr = cmd.ExecuteReader
While dr.Read
cboRoomType.Items.Add(dr("RoomType"))
End While
End Sub
Private Sub cboRoomType_SelectValueChanged(sender As Object, e As System.EventArgs) Handles cboRoomType.SelectedValueChanged
ValTx = cboRoomType.Text
qry = "select RoomType from tblRoomType where RoomType = '" & ValTx & "'"
cmd = New OleDb.OleDbCommand(qry, con)
dr = cmd.ExecuteReader
If dr.Read Then
ValTx = dr("RoomType")
End If
End Sub
Private Sub btnNext_Click(sender As System.Object, e As System.EventArgs) Handles btnNext.Click
qry = "Insert into tblCheckIn (Guest_ID, GRoomType, GRoomNo, GRoomID, GRoomAmount, CheckInDate, Days, ChecOutDate) values ('" &
txtGuestID.Text & "','" &
ValTx &
txtRoomNo.Text & "','" &
txtRoomId.Text & "','" &
txtRAmount.Text & "','" &
dtpCheckIn.Value &
txtDays.Text & "','" &
dtpCheckOut.Value & "')"
cmd = New OleDb.OleDbCommand(qry, con)
dr = cmd.ExecuteReader()
MsgBox("Successfully added in the database")
End Sub
No sé cuál es el problema aquí. Supongo que es el cuadro combinado, el valor seleccionado en el cuadro combinado debe agregarse en la base de datos. ¿Cuál es el valor correcto correcto para ese cuadro combinado? ¿Alguien me puede ayudar?