Adding to an Access Database - harder than I Imagi

Results 1 to 4 of 4

Thread: Adding to an Access Database - harder than I Imagi

  1. #1
    Join Date
    Dec 1969
    Posts
    5

    Default Adding to an Access Database - harder than I Imagi

    Help<BR><BR>I cannot add to my access database. The message I keep getting is: <BR>INSERT INTO Staff_Details (&#039StaffID&#039,&#039Surname&#039) VALUES (?,?) <BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e57&#039 <BR><BR>[Microsoft][ODBC Microsoft Access 97 Driver]Invalid string or buffer length <BR><BR>/charlton/input/sdinput.asp, line 49 <BR>***************************<BR>Line 49 simply executes the command object<BR>e.g. <BR>commandobject.execute<BR><BR>many thanks

  2. #2
    Join Date
    Dec 1969
    Posts
    27

    Default RE: Adding to an Access Database - harder than I I

    Have you checked to see if you are picking the values up? i presume all datatypes are correct.

  3. #3
    Join Date
    Dec 1969
    Posts
    41

    Default RE: Adding to an Access Database - harder than I I

    Could you post your pre-sending-it-to-database sql statement

  4. #4
    Join Date
    Dec 1969
    Posts
    5

    Default RE: Adding to an Access Database - harder than I I

    Here is my entire script <BR><BR>- thanks for looking <BR><BR>&#060;%@ LANGUAGE=VBScript %&#062;<BR>&#060;html&#062;<BR><BR>&#060;head title="Entry into Database"&#062;<BR>&#060;meta NAME="GENERATOR" Content="Microsoft FrontPage 3.0"&#062;<BR>&#060;title&#062;&#060;/title&#062;<BR>&#060;/head&#062;<BR><BR>&#060;body&#062;<BR>&#060;%<BR>< BR>&#039 ########## Begin Subroutine ##########<BR><BR>Sub AddEntry <BR><BR> Dim SQLDataInsertionString <BR> Dim CommandObject<BR><BR> <BR> Set CommandObject= Server.CreateObject("ADODB.Command")<BR><BR> <BR> Set CommandObject.ActiveConnection = DatabaseConnection <BR><BR> <BR> SQLDataInsertionString = "INSERT INTO Staf_Details (" & _<BR> "&#039StaffID&#039,&#039Surname&#039" &_<BR> "VALUES (?,?)" <BR><BR> <BR> CommandObject.CommandText = SQLDataInsertionString<BR><BR> <BR> CommandObject.Prepared = True<BR><BR> <BR> CommandObject.Parameters.Append _ <BR> CommandObject.CreateParameter("StaffID",200, ,255)<BR> CommandObject.Parameters.Append _<BR> CommandObject.CreateParameter("Surname",200, ,255 ) <BR> <BR> CommandObject("StaffID") = Request.Form.Item("StaffID")<BR> CommandObject("Surname") = Request.Form.Item("Surname")<BR> <BR><BR> CommandObject.Execute <BR><BR>End Sub<BR><BR>&#039 ########## End Subroutine ##########<BR><BR><BR>If Request.Form.Count &#060;= 0 Then<BR> Response.Write ("I am sorry but you did not fill in the Form.")<BR>Else<BR><BR> <BR> Set DatabaseConnection = Server.CreateObject("ADODB.Connection")<BR><BR> &#039My Database dsn is rd data<BR> DatabaseConnection.Open "rddata"<BR><BR> <BR> Call AddEntry <BR> DatabaseConnection.Close<BR> <BR> Response.Write ("Thank you, "&Request.Form.Item("FirstName")&"!<BR>")<BR> Response.Write ("Your guest book entry was added to the Guest Book!")<BR> <BR>End If<BR>%&#062;<BR><BR>&#060;p&#062;&nbsp;&#060;/p&#062;<BR><BR>&#060;hr&#062;<BR><BR>&#060;p&#062; This Web page was generated on &#060;%= Date %&#062; at &#060;%= Time %&#062;.<BR><BR>&#060;/body&#062;<BR>&#060;/html&#062;<BR>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •