Private Sub btnCheckIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheckIn.Click
            Dim litems As ListViewItem = New ListViewItem()
            DatabaseConnection.Add("INSERT INTO CheckIn(CheckInDate, Deposit, Staying, CheckOutDate, Amount, Balance, Roomnum) VALUES('" & txtCheckIn.Text & "','" & txtDeposit.Text & "', '" & txtStaying.Text & "', '" & DTCheckOut.Text & "', '" & cboRNum.Text & "', '" & txtTotal.Text & "', '" & txtRemain.Text & "')", conn)
            DatabaseConnection.Add("INSERT INTO Customer(Guestname, Platenumber) VALUES('" & txtname.Text & "','" & txtPlatenum.Text & "')", conn)

            'litems = New ListViewItem()
            ' LstPrice.Items.AddRange(New ListViewItem() {litems})
            MessageBox.Show("process Completed. adding of room done.")
        Catch ex As Exception
        End Try
    End Sub

i need help when i click check in i want to save the information type in the text box from the form to my datebase in different tables but it has an error when i click check in it says: "data type mismatch in criteria description codes in vb 2008".

Re: data type mismatch in criteria description codes in vb 2008 80 80

hello !
use this code to insert your data in your database table

dim myCon as new sqlconnection("string_connection")
dim cmd as new sqlcommand 
cmd.connection = myCon
cmd.commandtext= "insert into CheckIn(field1,filed2,field3,field4...." values (@field1,@field2,@field3,@field4.....)
cmd.parameter.add ("@field1".sqldatatype.varchar(50)).value = txtbox1.text
cmd.parameter.add ("@field2".sqldatatype.varchar(50)).value = txtbox2.text
cmd.parameter.add ("@field3".sqldatatype.varchar(50)).value = txtbox3.text
cmd.parameter.add ("@field4".sqldatatype.varchar(50)).value = txtbox4.text

hope this will help you to solve your prob , there may be some spelling mistake as i type all code here , so there is no way to check them , please check it out and if you have some prob with this code then do inform me :)

Best Regards

M.Waqas Aslam

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.