Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
hanarina
Starting Member
4 Posts |
Posted - 2007-04-04 : 23:30:41
|
| i have problem when i want to update another field in the same sql commandi have tried this code:"SQL = "UPDATE items SET item_status= 'issued' WHERE NO_INVENTORI= '" & Text5.Text & "' "Set RS = NothingSet RS = con.Execute(SQL)con.Close"an error occured said that" [Microsoft ](ODBC Microsoft Access Driver too few parameters.Expected 1."what that does mean?help me pliz.. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-04-04 : 23:56:40
|
| Instead of Set RS = con.Execute(SQL)usecon.Execute(SQL)MadhivananFailing to plan is Planning to fail |
 |
|
|
hanarina
Starting Member
4 Posts |
Posted - 2007-04-05 : 00:18:53
|
quote: Originally posted by madhivanan Instead of Set RS = con.Execute(SQL)usecon.Execute(SQL)Madhivananthanks for the suggestions, i've tried but still the same error occured..why?i dont know how to fix it.. Failing to plan is Planning to fail
|
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-04-05 : 01:18:48
|
| Make sure that you have used correct column namesMadhivananFailing to plan is Planning to fail |
 |
|
|
hanarina
Starting Member
4 Posts |
Posted - 2007-04-05 : 02:40:02
|
| i've tried so many times,my column names is correct,what is the problem? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-05 : 02:55:35
|
| Post full code.Peter LarssonHelsingborg, Sweden |
 |
|
|
hanarina
Starting Member
4 Posts |
Posted - 2007-04-05 : 03:24:43
|
| sql1 = "select * from BORROW"Set con = CreateObject("Adodb.connection")con.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & App.Path & "/BORROWSYSTEM.mdb"Set RS = CreateObject("ADODB.Recordset")RS.Open sql1, con, adOpenDynamic, adLockOptimisticRS.AddNewRS("NO_INVENTORI") = Text5.TextRS("ID_NO") = Text1.TextRS("NAME") = Text2.TextRS("SECTOR") = Text3.TextRS("ITEMS_NAME") = Text4.TextRS("DATE_BORROWED") = DTPicker1.ValueRS("DATE_RETURN") = DTPicker2.ValueRS("ITEMS_STATUS") = "issued"RS("DATE") = DateRS.UpdateSQL = "UPDATE items SET ITEMS_STATUS = 'issued' WHERE NO_INVENTORI= '" & Text5.Text & "' "Set RS = Nothingcon.Execute (SQL)con.Close |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-05 : 03:57:10
|
SQL = "UPDATE items SET ITEMS_STATUS = 'issued' WHERE NO_INVENTORI= '" & Text5.Text & "' "Set RS = Nothing -- THIS LINES DESTROYS THE RECORDSET!!!!!con.Execute (SQL)con.ClosePeter LarssonHelsingborg, Sweden |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2007-04-05 : 08:06:29
|
| Also i see there is a scope for SQL Injection.Make sure that Text5.Text doesnt contain any single Quote (')Chiraghttp://chirikworld.blogspot.com/ |
 |
|
|
|
|
|