Private Sub btnCheckIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheckIn.Click
 DatabaseConnection.ConnString()
Try
            Dim litems As ListViewItem = New ListViewItem()
            DatabaseConnection.ConnString()
            DatabaseConnection.DataOpen()
            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.")
            DatabaseConnection.DataClose()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        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".

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

dim myCon as new sqlconnection("string_connection")
dim cmd as new sqlcommand
mycon.open() 
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
.
.
.
cmd.executenonquery()
mycon.close()

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.