Have no problem getting my select queries to work using this method:
strSQL = "SELECT tblUI.IPAdd FROM tblUI WHERE (tblUI.IPAdd =?)"
arSPrm = Array(strRemHst)
Set rst = cmd.Execute(,arSPrm)
Can anyone point me to some examples of using this method for UPDATE and
INSERT queries? Can't seem to get it to work no matter what I can think of
to try. (If it is possible?)
Thanks,
Sean 7 2604
What-a-Tool wrote: Have no problem getting my select queries to work using this method:
strSQL = "SELECT tblUI.IPAdd FROM tblUI WHERE (tblUI.IPAdd =?)"
arSPrm = Array(strRemHst)
Set rst = cmd.Execute(,arSPrm)
Can anyone point me to some examples of using this method for UPDATE and INSERT queries? Can't seem to get it to work no matter what I can think of to try. (If it is possible?)
Thanks, Sean
You should have shown us what you tried. however:
strSQL = "INSERT INTO tblUI (IPAdd) VALUES (?)"
arSPrm = Array(strRemHst)
cmd.Execute ,arSPrm,129
Of course, this query will fail if you have required fields that aren't
referenced in this query.
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"
This I believe was the last thing I tried, without the 129 after the
parameter array in the execute statement
strSQL = "INSERT INTO tblUI (fldA, fldB, fldC, fldD) VALUES (?, ?, ? , ?)"
arSPrm = Array(strA, strB, strC, strD)
cmd.Execute ,arSPrm,129
--
Thank You
/ Sean Mc /
"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
"What-a-Tool" <Di*************************@IHateSpam.Com> wrote in message
news:H9x0e.72744$SF.19400@lakeread08... Have no problem getting my select queries to work using this method:
strSQL = "SELECT tblUI.IPAdd FROM tblUI WHERE (tblUI.IPAdd =?)"
arSPrm = Array(strRemHst)
Set rst = cmd.Execute(,arSPrm)
Can anyone point me to some examples of using this method for UPDATE and INSERT queries? Can't seem to get it to work no matter what I can think of to try. (If it is possible?)
Thanks, Sean
It looks all right. What happens when you run it? Have you verified that the
variables contain what you think they contain?
Suggestion: open your database in Access, create a new query and switch to
sql view. Enter the insert statement with actual hard-coded values in the
VALUES clause and make sure it works. Then, replace the hard-coded values
with parameter markers (?) for execution in ASP.
Bob Barrows
What-a-Tool wrote: This I believe was the last thing I tried, without the 129 after the parameter array in the execute statement
strSQL = "INSERT INTO tblUI (fldA, fldB, fldC, fldD) VALUES (?, ?, ? , ?)" arSPrm = Array(strA, strB, strC, strD) cmd.Execute ,arSPrm,129
-- Thank You
/ Sean Mc /
"I have not failed. I've just found 10,000 ways that won't work." - Thomas Alva Edison (1847-1931)
"What-a-Tool" <Di*************************@IHateSpam.Com> wrote in message news:H9x0e.72744$SF.19400@lakeread08... Have no problem getting my select queries to work using this method:
strSQL = "SELECT tblUI.IPAdd FROM tblUI WHERE (tblUI.IPAdd =?)"
arSPrm = Array(strRemHst)
Set rst = cmd.Execute(,arSPrm)
Can anyone point me to some examples of using this method for UPDATE and INSERT queries? Can't seem to get it to work no matter what I can think of to try. (If it is possible?)
Thanks, Sean
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Yes - when I enter the data direcrly thru a query within the Access program,
or thru asp with the standard sql string with values concatenated in,
everything is entered as it should be.
I have several different data types that I am lumping together within this
parameters array - String, Boolean, single, short integer, and date.
The error message I am getting is that my data "is of the wrong or
conflicting types, or outside acceptable bounds". I notice that entering
with the parameter method, there doesn't seem to be any way to enclose the
data type with '...' or #...#. Could this have something to do with it?
--
/ Sean Mc /
"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:Om**************@TK2MSFTNGP14.phx.gbl... It looks all right. What happens when you run it? Have you verified that the variables contain what you think they contain?
Suggestion: open your database in Access, create a new query and switch to sql view. Enter the insert statement with actual hard-coded values in the VALUES clause and make sure it works. Then, replace the hard-coded values with parameter markers (?) for execution in ASP.
Bob Barrows
What-a-Tool wrote: This I believe was the last thing I tried, without the 129 after the parameter array in the execute statement
strSQL = "INSERT INTO tblUI (fldA, fldB, fldC, fldD) VALUES (?, ?, ? , ?)" arSPrm = Array(strA, strB, strC, strD) cmd.Execute ,arSPrm,129
-- Thank You
/ Sean Mc /
"I have not failed. I've just found 10,000 ways that won't work." - Thomas Alva Edison (1847-1931)
"What-a-Tool" <Di*************************@IHateSpam.Com> wrote in message news:H9x0e.72744$SF.19400@lakeread08... Have no problem getting my select queries to work using this method:
strSQL = "SELECT tblUI.IPAdd FROM tblUI WHERE (tblUI.IPAdd =?)"
arSPrm = Array(strRemHst)
Set rst = cmd.Execute(,arSPrm)
Can anyone point me to some examples of using this method for UPDATE and INSERT queries? Can't seem to get it to work no matter what I can think of to try. (If it is possible?)
Thanks, Sean
-- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
What-a-Tool wrote: Yes - when I enter the data direcrly thru a query within the Access program, or thru asp with the standard sql string with values concatenated in, everything is entered as it should be.
I have several different data types that I am lumping together within this parameters array - String, Boolean, single, short integer, and date. The error message I am getting is that my data "is of the wrong or conflicting types, or outside acceptable bounds". I notice that entering with the parameter method, there doesn't seem to be any way to enclose the data type with '...' or #...#. Could this have something to do with it?
No. Delimiters are not needed when using parameters. Here is a repro showing
the passing of all of these parameter types (this is tested code which ran
without error for me):
<%
dim cn, cmd, arParms, sSQL, rs, sHTML
sSQL="CREATE TABLE InsertTest (" & _
"IntCol smallint," & _
"BoolCol bit," & _
"TextCol CHAR(15)," & _
"DateCol datetime," & _
"SngCol real)"
set cn = CreateObject("ADODB.Connection")
'substitute your database in the following string
cn.Open "provider=microsoft.jet.oledb.4.0;data source=" & _
server.MapPath("db7.mdb")
cn.Execute sSQL,,129
sSQL= "INSERT INTO InsertTest(IntCol,BoolCol,TextCol," & _
"DateCol,SngCol) VALUES (?,?,?,?,?)"
arParms=array(25,true,"test",#2005-03-22#,1.25)
set cmd=createobject("adodb.command")
cmd.CommandText=sSQL
set cmd.ActiveConnection=cn
cmd.Execute ,arParms,129
set cmd=nothing
sSQL="select IntCol,BoolCol,TextCol," & _
"DateCol,SngCol from InsertTest"
set rs=cn.Execute(sSQL,,1)
sHTML=rs.getstring(2,,"</td><td>","</td></tr><tr><td>")
rs.close:set rs=nothing
cn.Close:set cn=nothing
Response.Write "<table border=""1""><tr><td>"
Response.Write left(sHTML,len(sHTML)-8)
Response.Write "</table>"
%>
BTW, you may be interested in going to the next level: saved parameter
queries. The code is even easier to write than the Command object code. See: http://groups-beta.google.com/group/...d322b882a604bd
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"
> No. Delimiters are not needed when using parameters. Here is a repro showing the passing of all of these parameter types (this is tested code which ran without error for me):
<% dim cn, cmd, arParms, sSQL, rs, sHTML sSQL="CREATE TABLE InsertTest (" & _ "IntCol smallint," & _ "BoolCol bit," & _ "TextCol CHAR(15)," & _ "DateCol datetime," & _ "SngCol real)"
set cn = CreateObject("ADODB.Connection")
'substitute your database in the following string cn.Open "provider=microsoft.jet.oledb.4.0;data source=" & _ server.MapPath("db7.mdb")
cn.Execute sSQL,,129
sSQL= "INSERT INTO InsertTest(IntCol,BoolCol,TextCol," & _ "DateCol,SngCol) VALUES (?,?,?,?,?)"
arParms=array(25,true,"test",#2005-03-22#,1.25)
set cmd=createobject("adodb.command") cmd.CommandText=sSQL set cmd.ActiveConnection=cn cmd.Execute ,arParms,129 set cmd=nothing
sSQL="select IntCol,BoolCol,TextCol," & _ "DateCol,SngCol from InsertTest"
set rs=cn.Execute(sSQL,,1) sHTML=rs.getstring(2,,"</td><td>","</td></tr><tr><td>") rs.close:set rs=nothing cn.Close:set cn=nothing Response.Write "<table border=""1""><tr><td>" Response.Write left(sHTML,len(sHTML)-8) Response.Write "</table>"
%>
BTW, you may be interested in going to the next level: saved parameter queries. The code is even easier to write than the Command object code. See: http://groups-beta.google.com/group/...d322b882a604bd
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"
AhHa - I see my error - Delimeters are needed, but in the array itself. (and
I thought I tried everything - DOWH!)
Saved parameter query - Very interesting - Thanks for the help and the tips
Sean
What-a-Tool wrote: No. Delimiters are not needed when using parameters. Here is a repro
<snip> AhHa - I see my error - Delimeters are needed, but in the array itself.
Not really. I used delimiters in the array creation statement in my demo
because I was hard-coding the literal values. In a real application, I would
use the vbscript conversion functions to make sure my arguments were of the
proper type:
on error resume next
dim startdate
startdate=cdate(Request.form("StartDate"))
if err<> 0 then
response.write "Invalid Start Date"
response.end
end if
....
arParms = array( ..., startdate, ...)
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" This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bruno Alexandre |
last post by:
Hi guys,
withou using SP, I want to be able to add a Parameter to the SQL Query and
retrive the Recordset so I can use the Paging property under the recorset
object.... how can I do this?
I'm...
|
by: Job Lot |
last post by:
I have written 6 Queries in an Access DB, which are executed in a For
Each…Next loop to populate DataSet object. A new DataTable object is created
in DataSet for each query, as follows
Private...
|
by: Shapper |
last post by:
Hello,
I have created 3 functions to insert, update and delete an Access
database record. The Insert and the Delete code are working fine.
The update is not. I checked and my database has all...
|
by: James Radke |
last post by:
Hello,
I have a multithreaded windows NT service application (vb.net 2003) that I
am working on (my first one), which reads a message queue and creates
multiple threads to perform the processing...
|
by: Elliot M. Rodriguez |
last post by:
I implemented a very small, basic data access layer for my web application.
It works just fine, except for this one bug.
One of my methods returns an abstracted dataset. To accomodate X number of...
|
by: Siv |
last post by:
Hi,
I have a stored procedure that I want to execute and then wait in a loop
showing a timer whilst it completes and then carry on once I get
notification that it has completed. The main reason...
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted...
|
by: Darth Ferret |
last post by:
This thing is about to drive me crazy. I have about 50 queries in the AS400
that I need to put on a menu. Once I conquer this I have a bunch more rpg
reports that I need to pass a date to. In the...
|
by: Kenichi666 |
last post by:
I am new here - and new to the exciting world of programming.
I want to Update a table via a dropdownlistbox that contains the ID's.
So when you select the ID - it should update that selected...
|
by: bmallett |
last post by:
I am getting the following error:
Error Type:
ADODB.Command (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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,...
| |