[thelist] asp- EXECUTE statement
Anthony Baratta
anthony at baratta.com
Sat Jan 24 21:42:43 CST 2004
At 11:32 AM 1/24/2004, Lightning wrote:
>According to my text book on this, EXEDCUTE is read-only.
>Anyhow, I can't make it work.
Your asking about executing a query correct?
Here how I do it:
'' Edit for you Access Config String
Const DB_Connect_String = "Data
Source=<SererName>;UID=<UserName>;Pwd=<Password>;"
Set objDBConnSQL = NewDBConn(DB_Connect_String)
strQuery = "SELECT/INSERT/UPDATE BLAH BLAH BLAH"
'' If I'm just INSERTING OR UPDATING
dim iRowsAffected
objDBConnSQL.Execute strQuery,,iRowsAffected
if (iRowsAffected = 0) the
'' Something went wrong no rows affected
end if
''If I'm SELECTING
set objRS = objDBConnSQL.Execute(strQuery)
if not (objRS.BOF AND objRS.EOF) then
while not objRS.EOF
'' Do Something here
objRS.MoveNext
wend
else
'' Something wrong no rows
end if
''''''''''''''''''''''''''''''''''''''''''''''''''
'' NewDBConn Function
'' Required Info Passed to Function:
'' None
''''''''''''''''''''''''''''''''''''''''''''''''''
Function NewDBConn(DB_Connect_String)
Set objNewDBConn = Server.CreateObject("ADODB.Connection")
objNewDBConn.Open(DB_Connect_String)
Set NewDBConn = objNewDBConn
Set objNewDBConn = Nothing
End Function
---
Anthony Baratta
President
Keyboard Jockeys
"Conformity is the refuge of the unimaginative."
More information about the thelist
mailing list