473,657 Members | 2,435 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateOb ject("ADODB.Con nection")
myConn.Open = "DRIVER={Micros oft 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 1588
Leave out Set RS1 = ....

myConn.Execute( SQL1)

Bob Lehmann

"Brian" <qu******@iol.i e> 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.CreateOb ject("ADODB.Con nection")
myConn.Open = "DRIVER={Micros oft 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.CreateOb ject("ADODB.Con nection")
myConn.Open = "DRIVER={Micros oft 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 - adExecuteNoReco rds - 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_script s/_database_tools/DBConn.asp"
-->

<%
Dim yourSQL, yourArray, yourPagingArray

cp_TheConnectio nString = "DRIVER={Micros oft 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("Se lect this from that;")

'// SELECT or SP returning rs ... PAGING (page2/20per page example
below)
yourPagingArray = cp_SqlArray_Pag ing("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.i e> wrote:
hi,

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

Set myConn = Server.CreateOb ject("ADODB.Con nection")
myConn.Open = "DRIVER={Micros oft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath ("photoalbum.md b") & ""
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
10913
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: The following code provides for about half of the functionality I wanted: ==============code starts $bla = array(); foreach ($filelist as $file)
9
6681
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. Working dir : "C:\test copy" "copy.php" PHP script : <?php
0
2255
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 running fine, but immediatly after this msaccess hangs, when the focus goes back to the calling form ? Has anyone any idea what i can test or look at. Thanks a lot !!!!!!
0
1947
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 inside a package, the invocation will fail with a "Module not found" error. This PEP is aimed at fixing that :) Cheers, Nick.
15
2587
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 for Python 2.5. Previously, posting of a draft version of the PEP to python-dev and python-list didn't actually generate any responses. I'm not sure if that's an indication that people don't see the restriction to top-level modules as a problem...
18
2237
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 email. Preferably some documentation directly on this would be good but any other docuemtnation on executing a command line "command" would be great! Thanks,
15
11539
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 MSACCESS.EXE, tries them all, takes the first one it finds, and dies if none is found. Seems to me like at some time or another I was able to clone this .BAT file and implement it with no path. Something about MSACCESS being a registered application.
0
6771
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 about 97 customer enries so far.
1
3142
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 running fine, but immediatly after this msaccess hangs, when the focus goes back to the calling form ? Has anyone any idea what i can test or look at. Thanks a lot !!!!!!
4
8759
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
8395
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7330
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.