0

I made a query for inserting a value from text box to MS ACCESS db

sql = "INSERT INTO Equipment (port_number,display_name,equipment,tonnage,user_privilage) VALUES (" & CLng(txtPort.Text) & ", '" & CStr(txtDisplay.Text) & "', '" & CStr(txtCA.Text) & "', " & CLng(txtTonnage.Text) & ", '" & CStr(cmbUser.Text) & "')"

Actually I meant for inserting the data entered in the text box, but now saving is the code itself i,e; in port_number column 'CIng(txtPort.Text) ' will be saved
I dont know what's the problem
Please help me

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by vbdotnetlover
0

I don't see anything specifically wrong with your SQL statement, although I would caution against going directly to the database with unfiltered string content. Explore parameterized queries or, at minimum, escape single quotes in your strings (by replacing a single quote with 2 single quotes).

What about your connection and command objects? Are they throwing specific errors?

0

When I type some data on text box and click the button 'Save' in db only storing the word in the SQL command like

' & txtPort.Text & '

like that. There is no error messages . What you think. Can you help me

0

When I type some data on text box and click the button 'Save' in db only storing the word in the SQL command like like that. There is no error messages . What you think. Can you help me

Is there any error message?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.