System.Data.OleDb.OleDbException: Syntax error in UPDATE statement.

Discussion in 'ASP .Net' started by Mark Sandfox, May 6, 2004.

  1. Mark Sandfox

    Mark Sandfox Guest

    I have wrote this code just about every way I can think of and I still get
    the above error. One thing I noticed was when I reduce the amount of fields
    to be updated to about half it works, but that is not a solution. The code
    is below and I give great thanks to anyone who can help me here.

    Note: I have "" the memo fields thinking that it may have been a special
    character issue but I still get the same resulting error message.



    Sub Update_Info(Sender as Object, E as EventArgs)
    Dim cnMemberUpdate as OleDbConnection
    Dim strUpdate as string
    Dim cmdUpdate as OleDbCommand

    cnMemberUpdate = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
    Data Source=C:\Inetpub\wwwroot\WaucondaChamber\fpdb\members list and
    yp.mdb")
    strUpdate = "Update MemberList Set Company=@company, Contact=@contact,
    Address=@address, City=@city, State=@state, Zip=@zip, Phone=@phone,
    Fax=@fax, Email=@email, Domain=@domain, Description=@description,
    B2BDescription=@b2bdescription, Keywords=@keywords, UserName=@username,
    Password=@password Where ID = " & tbID.Text

    cmdUpdate = New OleDbCommand(strUpdate, cnMemberUpdate)
    cmdUpdate.Parameters.Add("@company",tbCompany.Text)
    cmdUpdate.Parameters.Add("@contact",tbContact.Text)
    cmdUpdate.Parameters.Add("@address",tbAddress.Text)
    cmdUpdate.Parameters.Add("@city",tbCity.Text)
    cmdUpdate.Parameters.Add("@state",tbState.Text)
    cmdUpdate.Parameters.Add("@zip",tbZipCode.Text)
    cmdUpdate.Parameters.Add("@phone",tbTelephone.Text)
    cmdUpdate.Parameters.Add("@fax",tbFax.Text)
    cmdUpdate.Parameters.Add("@email","")
    cmdUpdate.Parameters.Add("@domain", "")
    cmdUpdate.Parameters.Add("@description", "")
    cmdUpdate.Parameters.Add("@b2bdescription", "")
    cmdUpdate.Parameters.Add("@username",tbUserName.Text)
    cmdUpdate.Parameters.Add("@password",tbPassword.Text)


    cnMemberUpdate.Open()
    cmdUpdate.ExecuteNonQuery()
    cnMemberUpdate.Close()


    Response.Redirect("Update_Confirmation.htm")
    End Sub
     
    Mark Sandfox, May 6, 2004
    #1
    1. Advertising

  2. Mark Sandfox

    Mark Sandfox Guest

    Fixed problem = was reserved word issue. ACK


    "Mark Sandfox" <> wrote in message
    news:70umc.3521$...
    > I have wrote this code just about every way I can think of and I still get
    > the above error. One thing I noticed was when I reduce the amount of

    fields
    > to be updated to about half it works, but that is not a solution. The

    code
    > is below and I give great thanks to anyone who can help me here.
    >
    > Note: I have "" the memo fields thinking that it may have been a special
    > character issue but I still get the same resulting error message.
    >
    >
    >
    > Sub Update_Info(Sender as Object, E as EventArgs)
    > Dim cnMemberUpdate as OleDbConnection
    > Dim strUpdate as string
    > Dim cmdUpdate as OleDbCommand
    >
    > cnMemberUpdate = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
    > Data Source=C:\Inetpub\wwwroot\WaucondaChamber\fpdb\members list and
    > yp.mdb")
    > strUpdate = "Update MemberList Set Company=@company, Contact=@contact,
    > Address=@address, City=@city, State=@state, Zip=@zip, Phone=@phone,
    > Fax=@fax, Email=@email, Domain=@domain, Description=@description,
    > B2BDescription=@b2bdescription, Keywords=@keywords, UserName=@username,
    > Password=@password Where ID = " & tbID.Text
    >
    > cmdUpdate = New OleDbCommand(strUpdate, cnMemberUpdate)
    > cmdUpdate.Parameters.Add("@company",tbCompany.Text)
    > cmdUpdate.Parameters.Add("@contact",tbContact.Text)
    > cmdUpdate.Parameters.Add("@address",tbAddress.Text)
    > cmdUpdate.Parameters.Add("@city",tbCity.Text)
    > cmdUpdate.Parameters.Add("@state",tbState.Text)
    > cmdUpdate.Parameters.Add("@zip",tbZipCode.Text)
    > cmdUpdate.Parameters.Add("@phone",tbTelephone.Text)
    > cmdUpdate.Parameters.Add("@fax",tbFax.Text)
    > cmdUpdate.Parameters.Add("@email","")
    > cmdUpdate.Parameters.Add("@domain", "")
    > cmdUpdate.Parameters.Add("@description", "")
    > cmdUpdate.Parameters.Add("@b2bdescription", "")
    > cmdUpdate.Parameters.Add("@username",tbUserName.Text)
    > cmdUpdate.Parameters.Add("@password",tbPassword.Text)
    >
    >
    > cnMemberUpdate.Open()
    > cmdUpdate.ExecuteNonQuery()
    > cnMemberUpdate.Close()
    >
    >
    > Response.Redirect("Update_Confirmation.htm")
    > End Sub
    >
    >
     
    Mark Sandfox, May 7, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VDg=?=
    Replies:
    1
    Views:
    5,935
    Keith
    Nov 7, 2003
  2. Joe
    Replies:
    0
    Views:
    535
  3. =?Utf-8?B?QmlsbHkgSGFydA==?=

    System.Data.OleDb.OleDbException: Unspecified error

    =?Utf-8?B?QmlsbHkgSGFydA==?=, May 6, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,632
    arthur Wang [MSFT]
    Feb 25, 2005
  4. =?Utf-8?B?Sm9l?=
    Replies:
    2
    Views:
    4,174
    =?Utf-8?B?VGFtcGEgLk5FVCBLb2Rlcg==?=
    Jul 14, 2004
  5. psychomad
    Replies:
    2
    Views:
    5,322
    Alexey Smirnov
    Apr 10, 2007
Loading...

Share This Page