|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I created some parameterized queries in MS Access database for insert , update , select and delete. I successfully executed a select query using Command Object, but when i'm trying to execute a Action Query which inserts a row into a table it is giving error msg 'Action Queries can not be used as a row source'. Since there are no Stored Procedures in MS Access, i created Queries with parameters.
How can i insert a row into a table using Parameterized query? (I pass data through parameters). |
|
#2
|
|||
|
|||
|
public function runActionQuery(ByRef ErrorText as String, queryName as string, param1 as string, param1Name as string) as boolean
dim cxn as new adodb.connection dim cmd as new adodb.command on error go to queryError cxn.connectionString = "connect string here" cxn.open cmd.commandtype = adCmdStoredProc cmd.cmdText = queryName cmd.parameters.append cmd.createparameter(param1Name, adChar, adParamInput, 50, param1) cmd.execute runActionQuery = true exit function queryError: runActionQuery = false ErrorText = Err.Description end function push play on your project call it in asp: <% dim obj, result, ErrorText set obj = server.createobject("my.object") result = obj.runActionQuery(ErrorText, "procName", "paramValue", "paramName") if isnull(ErrorText) then print "successful" else print ErrorText end if %> of course you can add parameters and do it more elegantly but this is just a basic example |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > How to execute MS Access Action Queries from VB |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|