0
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    provider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="
    datafile = "E:\Software Development\Student Profiler\Student Profiler\School.accdb"
    connString = provider & datafile
    myConnection.ConnectionString = connString
    myConnection.Open()
    Dim str As String
    str = "Insert Into Basic_Information([ID],[Admitted In The Class],[Subject],[First Name Of The Student],[Middle Name Of The Student],[Last Name Of The Student],[Fathers Name],[Mothers Name],[Name Of The Railway Gurdian (If Any)],[Post],[Department],[Date Of Birth],[Address],[Permanent Address],[Distance From The School],[Religion],[Nationality],[Category],[Name Of The Cast],[Gender],[Name Of The Last School],[Marks Obtained],[OUt Of],[Percentage][Result][Dice Code Of The Last School]) Values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
    Dim cmd As OleDbCommand = New OleDbCommand(str, myConnection)
    cmd.Parameters.Add(New OleDbParameter("ID", CType(IDTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Admitted In The Class", CType(Admitted_In_The_ClassComboBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Subject", CType(SubjectComboBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("First Name Of The Student", CType(First_Name_Of_The_StudentTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Middle Name Of The Student", CType(Middle_Name_Of_The_StudentTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Last Name Of The Student", CType(Last_Name_Of_The_StudentTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Fathers Name", CType(Fathers_NameTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Mothers Name", CType(Mothers_NameTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Name Of The Railway Gurdian (If Any)", CType(Name_Of_The_Railway_Gurdian__If_Any_TextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Post", CType(PostTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Department", CType(DepartmentTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Date Of Birth", CType(Date_Of_BirthDateTimePicker1.Text, DateTime)))
    cmd.Parameters.Add(New OleDbParameter("Address", CType(AddressTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Permanent Address", CType(Permanent_AddressTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Distance From The School", CType(Distance_From_The_SchoolTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Religion", CType(ReligionComboBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Nationality", CType(NationalityComboBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Category", CType(CategoryComboBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Name Of The Cast", CType(Name_Of_The_CastTextBox.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Gender", CType(GenderComboBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Name Of The Last School", CType(Name_Of_The_Last_SchoolTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Marks Obtained", CType(Marks_ObtainedTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("OUt Of", CType(OUt_OfTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Percentage", CType(PercentageTextBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Result", CType(ResultComboBox1.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Dice Code Of The Last School", CType(Dice_Code_Of_The_Last_SchoolTextBox1.Text, String)))

    Try
        cmd.ExecuteNonQuery()
        cmd.Dispose()
        myConnection.Close()
        MsgBox("Data Saved Sucessfully")

    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
End Sub
2
Contributors
2
Replies
19
Views
4 Months
Discussion Span
Last Post by Joris Claassen
0

At least

,[OUt Of],[Percentage] [Result] [Dice Code Of The Last School]) 

should be changed into

,[OUt Of],[Percentage] ,  [Result] ,  [Dice Code Of The Last School]) 

(Additional spaces to make it easier to find the differences ....)
Are you sure the field/column name is OUt Of instead of Out Of?

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.