473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

executing a db command in asp

hi,

when i want to do an action to the database i am using the command

Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("photoalbum.mdb") & ""
Set RS1 = myConn.Execute(SQL1)

is there something else i can use if it is only an INSERT statement in the
sql because i dont actually need to create a recordset ?

Brian
Jul 19 '05 #1
3 1566
Leave out Set RS1 = ....

myConn.Execute(SQL1)

Bob Lehmann

"Brian" <qu******@iol.ie> wrote in message
news:bu**********@kermit.esat.net...
hi,

when i want to do an action to the database i am using the command

Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("photoalbum.mdb") & ""
Set RS1 = myConn.Execute(SQL1)

is there something else i can use if it is only an INSERT statement in the
sql because i dont actually need to create a recordset ?

Brian

Jul 19 '05 #2
Brian wrote:
hi,

when i want to do an action to the database i am using the command

Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("photoalbum.mdb") & ""
Set RS1 = myConn.Execute(SQL1)

is there something else i can use if it is only an INSERT statement
in the sql because i dont actually need to create a recordset ?

Brian


Absolutely:

myConn.Execute SQL1,,129

The 129 is the result of the addition of 2 constants:

1 - adCmdText - Tells ADO that you are executing a sql string - you should
use this setting when opening the recordset as well:
Set RS1 = myConn.Execute(SQL1,,1)

128 - adExecuteNoRecords - Tells ADO that it does not have to construct a
recordset object since the query being executed does not return records. If
you do not specify this setting, ADO will waste time and resources creating
a recordset object that will never be used.

HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #3

CLEAN, QUICK, IN AND OUT OF DATABASE !!!

Seriously ... checkout my DBConn.asp scripts at ...

http://www.coolpier.com/

click on Coolpier Scripts link, then on DBConn.asp, then on Code

I would put the full path, but I am making final adjustments to the
layout of my entire website, and the path will be changing for the
last time within the next 2 weeks. ((I am then creating a nav.asp page
to keep track of my scripts ... so if I change structure ever again in
the life of the page, the nav.asp page will be changed .. and any
posts I have on the group will still have good link))

All recordsets are turned into 2-dimensional arrays using getrows ...
clean, quick, in and out of database. since performance wise/thread
wise I believe it is better to get your rs into an array, and
seperately execute updates to it ... this I think is one of the best
ways generally.

<!-- #include virtual="/coolpier_scripts/_database_tools/DBConn.asp"
-->

<%
Dim yourSQL, yourArray, yourPagingArray

cp_TheConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=" & Server.MapPath("photoalbum.mdb") & ";"
Call cp_DBConn("open")

'//INSERT, UPDATE, DELETE, or SP not returning rs
Call cp_SqlExecute("insert into table1 ('someValue') value
('something') where userID = 'someID';")

'// SELECT or SP returning rs
yourArray = cp_SqlArray("Select this from that;")

'// SELECT or SP returning rs ... PAGING (page2/20per page example
below)
yourPagingArray = cp_SqlArray_Paging("Select this from that where
theother = 'somthing';", 2, 20)
Call DBConn("close")

'// AFTER DB CLOSED ... THEN mess with displaying the data in your
array!!!
%>
Brynn
www.coolpier.com
On Tue, 20 Jan 2004 00:58:06 -0000, "Brian" <qu******@iol.ie> wrote:
hi,

when i want to do an action to the database i am using the command

Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("photoalbum.mdb") & ""
Set RS1 = myConn.Execute(SQL1)

is there something else i can use if it is only an INSERT statement in the
sql because i dont actually need to create a recordset ?

Brian


Brynn
www.coolpier.com

I participate in the group to help give examples of code.
I do not guarantee the effects of any code posted.
Test all code before use!
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Falk Schneider | last post by:
I wrote a PHP shell script under Linux which puts all existing PS-Files within a directory into a list and should then start a single Ghostview window for each file. Sounds simple, but it's not: ...
9
by: Jean-Marc Molina | last post by:
Hello, I can't find a way to execute a Windows application, whose directory path contains blank spaces, from a PHP script. I also wonder if the problem happens under Linux and other OS. ...
0
by: rvdw | last post by:
Hi All, I've a serious problem with executing stored procedures (SQL2000) from an Access db (version 97). After executing a stored procedure , msaccess hangs. The whole call to the procedure is...
0
by: Nick Coghlan | last post by:
Anyone playing with the CPython interpreter's new command line switch might have noticed that it only works with top-level modules (i.e. scripts that are directly on sys.path). If the script is...
15
by: Nick Coghlan | last post by:
Python 2.4's -m command line switch only works for modules directly on sys.path. Trying to use it with modules inside packages will fail with a "Module not found" error. This PEP aims to fix that...
18
by: Brad Pears | last post by:
Can someone give me some sample code on how one would go about executing a command line "command" from within an ASP form? We need to run an application called GnuPG which allows us to encrypt an...
15
by: (Pete Cresswell) | last post by:
I've got a .BAT file that I use for executing various MS Access apps that I wrote way back in the days of 2.0. It's evolved over time, but it still contains a number of possible paths to...
0
by: NOSPAM | last post by:
Guys, I get the 'There was an error executing the command' error message. I an using win xp & Access 2002. I created a database using the MS Access template 'Order Entry' I have entered...
1
by: rvdw | last post by:
Hi All, I've a serious problem with executing stored procedures (SQL2000) from an Access db (version 97). After executing a stored procedure , msaccess hangs. The whole call to the procedure is...
4
by: Justine | last post by:
Hi All, How can v execute DOS command while executing Console Application written using C#, like cls,dir commnads. Thanz in Advance, Justine
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.