0

pl help

i m getting insert into error

Private Sub Addbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Addbtn.Click
        Dim mycmd1 As OleDbCommand
        Dim sqlq1 As String
        Try

       
            If Addbtn.Text = "Add" Then
                Idtxt.Text = Me.max + 1
                clear()
                Addbtn.Text = "Save"
                
            Else

                sqlq1 = "Insert into Member values(" & Idtxt.Text & ", '" & Nametxt.Text & "', '" & DateTimePicker1.Value & "', '" & gendercb.Text & "', '" & Classcb.Text & "','" & WingCb.Text & "', '" & FloorCb.Text & "', '" & RoomCb.Text & "', '" & occtxt.Text & "')"
                mycmd1 = New OleDbCommand(sqlq1, con)
                mycmd1.ExecuteNonQuery()
                MsgBox("added succesfuly")
                RecordRefresh()  // refresh the record
                
                Addbtn.Text = "Add"

where idtxt is number and remaining are text
and max is total row count

pl...........
help

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by noel9
0

You would have to specify the fields that you're inserting into like:

Insert into Member(?,?,?,?,?,?,?,?,?) values(" & Idtxt.Text & ", '" & Nametxt.Text & "', '" & DateTimePicker1.Value & "', '" & gendercb.Text & "', '" & Classcb.Text & "','" & WingCb.Text & "', '" & FloorCb.Text & "', '" & RoomCb.Text & "', '" & occtxt.Text & "')


This is because i don't really know your member_table values.....!!!

0

thanks i solved this error but new error is coming data type mismatch what should i do for this

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.