Can someone please tell me what's wrong with this instruction:
- String sql = "SELECT * FROM tblStudent WHERE Student Name = Samuel";
...And this one:
- String input = JOptionPane.showInputDialog("Who do you want to delete:");
-
String sql = "DELETE * FROM tblStudent WHERE Student Name = " + input;
Hi,
Some one gave good response. I am newly added in this group...
so u better to use string.Format method .. here we can avoid collisions
if u want assign any parameter to your query so better to create one format string based on that no need to take care of complicated built query
string.Format(" Select statements from table where col =place holer",col1,col2,...)
Ex:
String.Format("Select * FROM tblStudent WHERE StudentName ='{0}' ",StudentName);
SeleStat=String.Format("DELETE * FROM tblStudent WHERE StudentName = '{0}'",input);
write like this ..if column is string u have specify place holder in string otherwise no need strings(Invited commas)...
Note: columns should not take any gaps
ok
if it is helpful take it
otherwise ...take just kidding
bye