2 Replies - 281 Views - Last Post: 10 April 2017 - 04:13 AM

#1 hdnet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-April 17

MySQL Syntax Error

Posted 10 April 2017 - 02:10 AM

Hi Friends,

I use MySql 5.7, Net Connector 6.6.7 and Visual Studio Vb Net 2008

I Have error result when executing these code;


modkoneksi.bukaDB()
SIMPAN = "INSERT INTO

GUESTMEMBER(membercode,nama,alamat,vip,birthday,nation,company,specialrate,diskon,segmen,purpose,settledby,limit,idno) " & _
"VALUES(?p1, ?p2, ?p3, ?p4, ?p5, ?p6, ?p7, ?p8, ?p9, ?p10, ?p11, ?p12, ?p13, ?p14)"

CMD = New MySqlCommand(SIMPAN, conn)

CMD.Parameters.AddWithValue("?p1", kodetxt)
CMD.Parameters.AddWithValue("?p2", namatxt)
CMD.Parameters.AddWithValue("?p3", alamattxt)
CMD.Parameters.AddWithValue("?p4", viptxt)
CMD.Parameters.AddWithValue("?p5", tanggallahirtxt)
CMD.Parameters.AddWithValue("?p6", nationalitytxt)
CMD.Parameters.AddWithValue("?p7", perusahaantxt)
CMD.Parameters.AddWithValue("?p8", specialratetxt)
CMD.Parameters.AddWithValue("?p9", diskontxt)
CMD.Parameters.AddWithValue("?p10", segmentxt)
CMD.Parameters.AddWithValue("?p11", purposetxt)
CMD.Parameters.AddWithValue("?p12", settledbytxt)
CMD.Parameters.AddWithValue("?p13", limittxt)
CMD.Parameters.AddWithValue("?p14", idnotxt)


CMD.ExecuteNonQuery()



conn.Dispose()

'CMD.Dispose()
conn.Close()
Tampilgrid()


after execution vb result error as below:


You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit,idno) VALUES(_binary 'System.Windows.Forms.TextBox, Text: 1001', _binary '' at line 1

beside '?' ,i have tried also before using '@' for the p variable but same result

What's wrong in my code ,can help me?.Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: MySQL Syntax Error

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4128
  • View blog
  • Posts: 13,023
  • Joined: 08-June 10

Re: MySQL Syntax Error

Posted 10 April 2017 - 02:12 AM

limit is a reserved keyword.
Was This Post Helpful? 1
  • +
  • -

#3 hdnet  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-April 17

Re: MySQL Syntax Error

Posted 10 April 2017 - 04:13 AM

Oop.. it works now after rename limit to other name
Thanks Domilich.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1