Jump to content

Now It's The Database


Recommended Posts

The Syntax is exaxtly like the file addapted it from here I'm using the .net version.

 

Browser gives me this:

 

Syntax error in INSERT INTO statement.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

 

Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement

 

'DB ADD
   Sub AddNewRecord()
   'Values
   Dim objemer as String
   Dim eobjschool as string
   objschool = Schoolname.text + district.text
   objemer = contact.text + relation.text
              Dim objCommand As OleDbCommand
              Dim strSQLQuery As String
   
              ' Our insert command
          strSQLQuery = "INSERT INTO Students" _
              & "(FEE, STUDENT, ., GRADE, PHONE, PROF, APTITUDE, INTEREST, MED-INFO, SCHOOL, EMER-PHONE, CONTACT, ADDRESS, LASTUPDATE, LASTTIME, CITY, STATE, ZIP, EMAIL, INSURANCE, SESSION, BIRTHDATE, DIVISION)" _
              & "VALUES (@FEE, @STUDENT, @., @GRADE, @PHONE, @PROF, @APTITUDE, @INTEREST, @MEDINFO, @SCHOOL, @EMERPHONE, @CONTACT, @ADDRESS, @LASTUPDATE, @LASTTIME, @CITY, @STATE, @ZIP, @EMAIL, @INSURANCE, @SESSION, @BIRTHDATE, @DIVISION)"
   
   
   
              ' Create new command object passing it our SQL insert
              ' and telling it which connection to use.
              objCommand = New OleDbCommand(strSQLQuery, objConnection)
   
              ' Add parameters that our SQL command takes:
          objCommand.Parameters.Add(New OleDbParameter("@FEE", OleDbType.Integer))
          objCommand.Parameters.Add(New OleDbParameter("@STUDENT", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@.", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@GRADE", OleDbType.Integer))
          objCommand.Parameters.Add(New OleDbParameter("@PHONE", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@PROF", OleDbType.Integer))
          objCommand.Parameters.Add(New OleDbParameter("@APTITUDE", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@INTEREST", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@MED-INFO", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@SCHOOL", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@EMER-PHONE", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@CONTACT", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@Address", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@LASTUPDATE", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@LASTTIME", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@CITY", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@STATE", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@ZIP", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@EMAIL", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@INSURANCE", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@SESSION", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@BIRTHDATE", OleDbType.VarChar, 255))
          objCommand.Parameters.Add(New OleDbParameter("@DIVISION", OleDbType.VarChar, 255))
   
   
              ' Set the values of these parameters:
          objCommand.Parameters("@FEE").Value = objFee
          objCommand.Parameters("@STUDENT").Value = Student.text
          objCommand.Parameters("@.").Value = ..SelectedItem.Value
          objCommand.Parameters("@GRADE").Value = Grade.SelectedItem.Value
          objCommand.Parameters("@PHONE").Value = phone.text
          objCommand.Parameters("@PROF").Value = objProf
          objCommand.Parameters("@APTITUDE").Value = APTITUDE.SelectedItem.Value
          objCommand.Parameters("@INTEREST").Value = Interest.SelectedItem.Value
          objCommand.Parameters("@MED-INFO").Value = medinfo.text
          objCommand.Parameters("@SCHOOL").Value = objschool
          objCommand.Parameters("@EMER-PHONE").Value = emerphone.text
          objCommand.Parameters("@CONTACT").Value = objemer
          objCommand.Parameters("@ADDRESS").Value = Address.text
          objCommand.Parameters("@LASTUPDATE").Value = CSTR(Now())
          objCommand.Parameters("@LASTTIME").Value = CSTR(Now())
          objCommand.Parameters("@CITY").Value = City.text
          objCommand.Parameters("@STATE").Value = "WA"
          objCommand.Parameters("@ZIP").Value = zip.text
          objCommand.Parameters("@EMAIL").Value = email.text
          objCommand.Parameters("@INSURANCE").Value = Insurance.text
          objCommand.Parameters("@SESSION").Value = Program.SelectedItem.Value
          objCommand.Parameters("@BIRTHDATE").Value = BirthDate.text
          objCommand.Parameters("@DIVISION").Value = "USS"
   
              ' Open the connection, execute the command, and close the connection.
              objConnection.Open()
              objCommand.ExecuteNonQuery()
              objConnection.Close()
   
          End Sub

 

Thanks all

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...