Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9282127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:17:50+00:00 2026-06-18T18:17:50+00:00

Im trying an update statement in vb.net. my code is below ‘Connection statement Dim

  • 0

Im trying an update statement in vb.net. my code is below

'Connection statement
Dim con As New MySqlConnection("server =nnnnnnnnn; user =nnnnnnnnn; password= nnnnnnnnnnnnnn; database =nnnnn;")

'SQL query
Dim cmdText = "UPDATE contacts SET (title_name = @cotitle, contact_name = @coname, contact_mname = @comname, contact_pref_fname = @coprefname, contact_jobtitle = @cojobtitle, contact_job_sector = @cojobsector, contact_company = @coemp, contact_preflang = @colang, contact_home_nation = @cohomenat, contact_srequirements = @cosreqs, contact_street = @costreet, contact_town = @cotown, contact_postcode = @copcode, contact_resident_country = @cocountry, contact_email = @coemail, contact_phone = @cophone, contact_mobile = @comob, contact_notes = @conotes, contact_influence_level = @coinf, contact_optout_email = @cooptemail, contact_optout_phone = @cooptphone, contact_optout_post = @cooptpost WHERE contact_id = @coid);"

'commit SQL query with connection statement
Dim com As New MySqlCommand(cmdText, con)

'place fields into parameters for the query
com.Parameters.AddWithValue("@coid", contact_id.Text)
com.Parameters.AddWithValue("@cotitle", ComboBox1.Text)
com.Parameters.AddWithValue("@coname", TextBox3.Text)
com.Parameters.AddWithValue("@comname", TextBox4.Text)
com.Parameters.AddWithValue("@coprefname", TextBox1.Text)
com.Parameters.AddWithValue("@cojobtitle", TextBox2.Text)
com.Parameters.AddWithValue("@cojobsector", ComboBox7.Text)
com.Parameters.AddWithValue("@coemp", ComboBox8.Text)
com.Parameters.AddWithValue("@colang", ComboBox3.Text)
com.Parameters.AddWithValue("@cohomenat", ComboBox4.Text)
com.Parameters.AddWithValue("@cosreqs", RichTextBox2.Text)
com.Parameters.AddWithValue("@costreet", RichTextBox1.Text)
com.Parameters.AddWithValue("@cotown", TextBox8.Text)
com.Parameters.AddWithValue("@copcode", TextBox9.Text)
com.Parameters.AddWithValue("@cocountry", ComboBox5.Text)
com.Parameters.AddWithValue("@coemail", TextBox6.Text)
com.Parameters.AddWithValue("@cophone", TextBox10.Text)
com.Parameters.AddWithValue("@comob", TextBox12.Text)
com.Parameters.AddWithValue("@conotes", RichTextBox4.Text)
com.Parameters.AddWithValue("@coinf", ComboBox6.Text)
com.Parameters.AddWithValue("@cooptemail", CheckBox1.Checked)
com.Parameters.AddWithValue("@cooptphone", CheckBox2.Checked)
com.Parameters.AddWithValue("@cooptpost", CheckBox3.Checked)

'this will commit the record to the DB
con.Open()
com.ExecuteNonQuery()
con.Close()

it says error in SQL syntax, but i cant spot it. any help appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T18:17:52+00:00Added an answer on June 18, 2026 at 6:17 pm

    your update query should be like this

    UPDATE contacts SET title_name = @cotitle, .....;"

    Need to remove the ( and )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem when trying to execute this update statement (below) using C#
I am trying to write an update statement for inserting data from asp.net gridview
I am trying to implement an update statement using a prepared statement in a
I'm trying to a create an update statement along the following lines: TABLE car:
I have the following SQL statement where i'm trying to update multiple rows matching
I'm trying to write a valid mysql statement that would allow me to update
Im trying to update a table with the following code. If I change WHERE
I am relatively new to Nhibernate. I am trying to update a stored procedure.
I am trying to update two columns using the same update statement can it
I'm trying to get this Python MYSQL update statement correct(With Variables): cursor.execute (UPDATE tblTableName

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.