Question Input Query question

fadedkeil

Member
Joined
Feb 8, 2009
Messages
12
Programming Experience
Beginner
I'm inputting student records but i get this error
Untitled-4.jpg

And i even built a exe of my project and the inputs are in different fields
here's my input code
VB.NET:
  Public Sub DbCon()
        con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\proj\Module_1_Encoder\enrollment.mdb"
        con.Open()
        sql = "SELECT StudNum, MName, LName, FName, Address, SchoolYr, Mother, Father, Gender, BPBD, Religion, DateEntered, MOccupation, FOccupation, Guardian, Height, Weight, Age, Mobile, Phone, YearLvl FROM tblStudent"
        da = New OleDb.OleDbDataAdapter(sql, con)
        da.Fill(ds, "tblStudent")
        con.Close()
    End Sub
VB.NET:
            DbCon()
            con.Open()
            sql = "insert into tblStudent values('" & StudNumMaskedTextBox.Text & "','" & MNameTextBox.Text & _
            "','" & LNameTextBox.Text & "','" & FNameTextBox.Text & "','" & AddressTextBox.Text & _
            "','" & SchoolYrTextBox.Text & "','" & MotherTextBox.Text & "','" & FatherTextBox.Text & _
            "','" & GenderTextBox.Text & "','" & BPBDTextBox.Text & "','" & ReligionTextBox.Text & _
            "','" & DateEnteredTextBox.Text & "','" & MOccupationTextBox.Text & "','" & FOccupationTextBox.Text & _
            "','" & GuardianTextBox.Text & "','" & HeightTextBox.Text & "','" & WeightTextBox.Text & _
            "','" & AgeTextBox.Text & "','" & MobileMaskedTextBox.Text & "','" & PhoneMaskedTextBox.Text & _
            "','" & YearLvlTextBox.Text & "')"
            cm.CommandText = sql
            cm = New OleDb.OleDbCommand(sql, con)
            cm.ExecuteNonQuery()
            con.Close()
            MsgBox("Encoded")
            Me.Close()
 
Right after that, read the DW2 link in my signature, section on Creating a Simple Data App
 

Latest posts

Back
Top