plz tell how to get rid of database error?
-
dim str as string str= "INSERT INTO employees Values(@ID,@FN,@LN)" dim InsCom as new SqlCommand(str,SqlConnection1) plz tell me what is the error in this code. MS Visual Studio.NEt shows error in the following SqlCommand function. when i write this line dim InsCom as new sqlcommand(str,Sqlconnection1) then after new the window pops up but there is nothing like sqlcommand in there? OR plz tell how to execute a query from a MS-ACCESS database? thnx Rashmi
-
dim str as string str= "INSERT INTO employees Values(@ID,@FN,@LN)" dim InsCom as new SqlCommand(str,SqlConnection1) plz tell me what is the error in this code. MS Visual Studio.NEt shows error in the following SqlCommand function. when i write this line dim InsCom as new sqlcommand(str,Sqlconnection1) then after new the window pops up but there is nothing like sqlcommand in there? OR plz tell how to execute a query from a MS-ACCESS database? thnx Rashmi
You need to build your sql string differently. The parameters are inside of your quote marks so the values can not be passed in. Depending on your datatypes it should look something more like: dim str as string str= "INSERT INTO employees Values(" + @ID + "," + @FN + "," + @LN + ")" dim InsCom as new SqlCommand(str,SqlConnection1) If your datatypes are int you may have to do something like str(@ID) as well as add single quotes if your datatypes are char.