Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i create small vb.net project. when i delete record by name display erro message like this " system.data.sqlclient.sqlexception:invalid column name 'jak'. at system .data.........
but actualy 'jak' and his infomation saved in table. then i try delete his infomation by his age. its worked. but i have no idea delete infomation. by name. my code is
try


Dim del As new sqlcomand("DELETE members WHERE name="& textbox1.text & "", dbcon)
dbconn.open()
del.execuenonquery()
dbconn.close()
Catch ex as Exception
Msgbox(ex.tostring)
end try


is it corect??
please friends help me. im using vb.net and sql server
thank
Posted
Updated 2-Feb-12 21:46pm
v4
Comments
palraj001 3-Feb-12 3:37am    
hi
Your delete query is not correct.
Amal anjula 3-Feb-12 4:37am    
whats the wrong frd? pls

You have to add single quoat

Try below code


C#
dim del as.new sqlcomand("DELETE members WHERE name='"& textbox1.text & "'", dbcon)
dbconn.open()
del.execuenonquery()
dbconn.close()
catch ex as exception
msgbox(ex.tostring)
end try
 
Share this answer
 
Comments
Amal anjula 3-Feb-12 4:18am    
as.new
is it corect friend?
U miss FROM keyword

read this
http://www.w3schools.com/sql/sql_delete.asp[^]
 
Share this answer
 
Comments
Amal anjula 3-Feb-12 3:59am    
i do it.bt again display erro msg like erlier time.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900