473,387 Members | 3,821 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.

Passing Parameters to a query

I am running into an issue when I try to write more than 1024 characters to
a memo field. Apparantly the odbc connection I am using does not permit
literals to be larger that 1024 characters. This Memo filed can take
virtually infinate data, so the solution seems to be use parameters. My
problem is I have never heard of this and need this to work ASAP. Does
anyone have a simple example of how Parameters work using ASP?


Jul 19 '05 #1
18 2826
Johnd wrote:
I am running into an issue when I try to write more than 1024
characters to a memo field. Apparantly the odbc connection I am
That's your first problem. You should be using the native Jet OLEDB
provider. See www.able-consulting.com/ado_conn.htm for examples.
using does not permit literals to be larger that 1024 characters.
This Memo filed can take virtually infinate data, so the solution
seems to be use parameters. My problem is I have never heard of this
and need this to work ASAP. Does anyone have a simple example of how
Parameters work using ASP?


http://www.google.com/groups?hl=en&l...phx.gbl&rnum=6

HTH,
Bob Barrows

--
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.
Jul 19 '05 #2
Thanks Bob but heres a little more detail.

I am using Advantage server 6.2

here is my code:
// Set Conn = Server.CreateObject("ADODB.Connection")
// Conn.Open "DSN=LocalOP"
// strQuery = "insert into NCRheadcomments (hdrcomid, headerid, comdate,
userid, comments, comtime)" &_
// "values(10084,10080, '" & FormatDateTime( Date(), VBshortDate ) &_
// "', '" & session("CurrentUser") & "', '" & CurrentComment & "', '" &
time & "')"
// Set objRS = Conn.Execute(strQuery)
// conn.close
My problem is CurrentComment is larger than 1024 characters. Is there a way
to get this to work without using a saved query as I do not believe that is
available to my at this time.

John,

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:uX**************@TK2MSFTNGP09.phx.gbl...
Johnd wrote:
I am running into an issue when I try to write more than 1024
characters to a memo field. Apparantly the odbc connection I am
That's your first problem. You should be using the native Jet OLEDB
provider. See www.able-consulting.com/ado_conn.htm for examples.
using does not permit literals to be larger that 1024 characters.
This Memo filed can take virtually infinate data, so the solution
seems to be use parameters. My problem is I have never heard of this
and need this to work ASAP. Does anyone have a simple example of how
Parameters work using ASP?


http://www.google.com/groups?hl=en&l...phx.gbl&rnum=6
HTH,
Bob Barrows

--
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.

Jul 19 '05 #3
Johnd wrote:
Thanks Bob but heres a little more detail.

I am using Advantage server 6.2

here is my code:
// Set Conn = Server.CreateObject("ADODB.Connection")
// Conn.Open "DSN=LocalOP"
// strQuery = "insert into NCRheadcomments (hdrcomid, headerid,
comdate,
userid, comments, comtime)" &_
// "values(10084,10080, '" & FormatDateTime( Date(), VBshortDate
) &_ // "', '" & session("CurrentUser") & "', '" &
CurrentComment & "', '" &
time & "')"
// Set objRS = Conn.Execute(strQuery)
Why are you creating a recordset object to run a non-records-returning
query? Just do this:
Conn.Execute strQuery,,129

// conn.close
My problem is CurrentComment is larger than 1024 characters. Is
there a way
to get this to work without using a saved query as I do not believe
that is
available to my at this time.


Why not? According to their website, Advantage supports stored procedures.

You will likely need to use AppendChunk
(http://msdn.microsoft.com/library/en...damth01_3.asp), a
Command object and a Parameter object. Check out the example in that link.

I'm sorry but, due to my non-familiarity with Advantage, I am not going to
be able to get into specifics. Have you tried their support system?

Bob Barrows
--
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.
Jul 19 '05 #4
Thankyou for taking the time to reply on this issue. I realize this is not
the best group for this post, but I can't find any leads elsewhere. Also I
was hoping that this waas a limitation of SQL and therefore best handled
here. I have looked for stored procedures and been told that they are not
supported in the Novell version of advanage 6.2 I will look further into
it. In the mean time I will look at the "chunk" solution you have suggested
and post my results for future reference.

John,

BTW. It never occured to me to just execute the object Conn.Execute
strQuery,,129

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:ON**************@TK2MSFTNGP10.phx.gbl...
Johnd wrote:
Thanks Bob but heres a little more detail.

I am using Advantage server 6.2

here is my code:
// Set Conn = Server.CreateObject("ADODB.Connection")
// Conn.Open "DSN=LocalOP"
// strQuery = "insert into NCRheadcomments (hdrcomid, headerid,
comdate,
userid, comments, comtime)" &_
// "values(10084,10080, '" & FormatDateTime( Date(), VBshortDate
) &_ // "', '" & session("CurrentUser") & "', '" &
CurrentComment & "', '" &
time & "')"
// Set objRS = Conn.Execute(strQuery)


Why are you creating a recordset object to run a non-records-returning
query? Just do this:
Conn.Execute strQuery,,129

// conn.close
My problem is CurrentComment is larger than 1024 characters. Is
there a way
to get this to work without using a saved query as I do not believe
that is
available to my at this time.


Why not? According to their website, Advantage supports stored procedures.

You will likely need to use AppendChunk
(http://msdn.microsoft.com/library/en...damth01_3.asp), a
Command object and a Parameter object. Check out the example in that link.

I'm sorry but, due to my non-familiarity with Advantage, I am not going to
be able to get into specifics. Have you tried their support system?

Bob Barrows
--
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.

Jul 19 '05 #5

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:ON**************@TK2MSFTNGP10.phx.gbl...

Why are you creating a recordset object to run a non-records-returning
query? Just do this:
Conn.Execute strQuery,,129


What's this Bob? Is that a numeric value of 129 instead of defining a
constant? :P

Ray at work
Jul 19 '05 #6
Ray at <%=sLocation%> wrote:
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:ON**************@TK2MSFTNGP10.phx.gbl...

Why are you creating a recordset object to run a
non-records-returning query? Just do this:
Conn.Execute strQuery,,129


What's this Bob? Is that a numeric value of 129 instead of defining a
constant? :P

I was going to tell him to go look it up if he asked ;-)
--
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.
Jul 19 '05 #7
"Ray at <%=sLocation%>" wrote:

What's this Bob? Is that a numeric value of 129 instead of
defining a constant?


What would he call it? adCmdTextExecuteNoRecords ?
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #8
adChar?

Ray at work

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:uR**************@tk2msftngp13.phx.gbl...
"Ray at <%=sLocation%>" wrote:

What's this Bob? Is that a numeric value of 129 instead of
defining a constant?
What would he call it? adCmdTextExecuteNoRecords ?
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.

Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.

Jul 19 '05 #9
If you guys put as much effort into helping people as you do into you
humour, I think there may be hope for some of us rookies :-)
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
adChar?

Ray at work

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:uR**************@tk2msftngp13.phx.gbl...
"Ray at <%=sLocation%>" wrote:

What's this Bob? Is that a numeric value of 129 instead of
defining a constant?


What would he call it? adCmdTextExecuteNoRecords ?
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.

Use
of this email address implies consent to these terms. Please do not

contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.


Jul 19 '05 #10
Does that mean your problem is not solved?

Bob yelled at me once for suggesting that people should memorize common
constants and use their numeric values, so I had to call him on it. :]

Ray at work

"Johnd" <johnjob{a}myway.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
If you guys put as much effort into helping people as you do into you
humour, I think there may be hope for some of us rookies :-)
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
adChar?

Ray at work

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:uR**************@tk2msftngp13.phx.gbl...
"Ray at <%=sLocation%>" wrote:
>
> What's this Bob? Is that a numeric value of 129 instead of
> defining a constant?

What would he call it? adCmdTextExecuteNoRecords ?
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per
message. Use
of this email address implies consent to these terms. Please do not

contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.



Jul 19 '05 #11
I have been programming for 14 years and I hate trying to figure out what a
constant means in a example. I know they make code more "readable", but I
am never sure if it's a constant, function, Reserved word etc. so when I am
trying to understand something new, I prefer to see it without constants and
then I'll make my own constants if I need them.

Anyway I have tried switching to native OLE, (so far unsuccessful) and have
yet to find any good reference to using parameters on advantage 6.2 for
Novell. I have rewritten my routine to truncate anything over 1024 chars
and create a new record with this data. Since this is only tracking info,
it doesn't matter, but I will need a solution because I have other memo
fields that I can't just truncate.

John,

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:O4**************@TK2MSFTNGP10.phx.gbl...
Does that mean your problem is not solved?

Bob yelled at me once for suggesting that people should memorize common
constants and use their numeric values, so I had to call him on it. :]

Ray at work

"Johnd" <johnjob{a}myway.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
If you guys put as much effort into helping people as you do into you
humour, I think there may be hope for some of us rookies :-)
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
adChar?

Ray at work

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:uR**************@tk2msftngp13.phx.gbl...
> "Ray at <%=sLocation%>" wrote:
> >
> > What's this Bob? Is that a numeric value of 129 instead of
> > defining a constant?
>
> What would he call it? adCmdTextExecuteNoRecords ?
>
>
> --
> Dave Anderson
>
> Unsolicited commercial email will be read at a cost of $500 per message. Use
> of this email address implies consent to these terms. Please do not
contact
> me directly or ask me to contact you directly for assistance. If your > question is worth asking, it's worth posting.
>
>



Jul 19 '05 #12
Dave Anderson wrote:
"Ray at <%=sLocation%>" wrote:

What's this Bob? Is that a numeric value of 129 instead of
defining a constant?


What would he call it? adCmdTextExecuteNoRecords ?

:-)

I wouldn't create a new constant: I would add together the already-existing
constants.

adCmdText + adExecuteNoRecords

Bob
--
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.
Jul 19 '05 #13
Ray at <%=sLocation%> wrote:
Does that mean your problem is not solved?

Bob yelled at me once for suggesting that people should memorize
common constants and use their numeric values, so I had to call him
on it. :]


Now wait a minute, I have never yelled at anyone in these newsgroups ....
well ... not until this week that is <blush>

I expressed and defended my opinion ... yes, that's the ticket :-)

Bob

--
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.
Jul 19 '05 #14
Johnd wrote:
I have been programming for 14 years and I hate trying to figure out
what a constant means in a example. I know they make code more
"readable", but I am never sure if it's a constant, function,
Reserved word etc.
That's where good naming conventions come to the rescue.
so when I am trying to understand something new,
I prefer to see it without constants and then I'll make my own
constants if I need them.

I'm the opposite. I hate having to look up what the magic numbers mean. I've
got better use for my brainpower than memorizing a bunch of numbers:
especially when the documentation shows their hex values <grr>

HTH,
Bob Barrows

--
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.
Jul 19 '05 #15

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:O8**************@TK2MSFTNGP10.phx.gbl...
I'm the opposite. I hate having to look up what the magic numbers mean.

I've got better use for my brainpower than memorizing a bunch of numbers:
especially when the documentation shows their hex values <grr>


All programmers should be able to look at a hex number or a binary number
and understand it without having to translate it back to the arbitrary base
10 number system. If you're old school, octets are also good to know. The
key, though, is to not think, "okay, 100101 is, eh, 37." No, it's 100101.

This is tongue-in-cheek, of course...

Ray at work
Jul 19 '05 #16
Johnd wrote:

Anyway I have tried switching to native OLE, (so far unsuccessful)
and have yet to find any good reference to using parameters on
advantage 6.2 for Novell. I have rewritten my routine to truncate
anything over 1024 chars and create a new record with this data.
Since this is only tracking info, it doesn't matter, but I will need
a solution because I have other memo fields that I can't just
truncate.


Here is a way to parameterize your dynamic sql statement:
'you will need to define the constants used, either by including the
'adovbs.inc file, or by using the method described here:
http://www.aspfaq.com/show.asp?id=2112
strQuery = "insert into NCRheadcomments (hdrcomid, " & _
"headerid,comdate,userid, comments, comtime) " &_
"values(10084,10080, ?,?,?,?)"

Set cmd = server.createobject("adodb.command")
cmd.CommandType = 1 'adCmdText
set cmd.ActiveConnection = conn
set params = cmd.Parameters
with cmd

'here is where I will have trouble. I am not sure of the proper
datatype mappings for the Advantage datatypes. See here
'for the mappings for various other databases:
http://www.able-consulting.com/ADODataTypeEnum.htm
'Here are my guesses:

params.append .CreateParameter("Date",adVarChar, _
adParamInput, 8, FormatDateTime( Date(), VBshortDate))
params.append .CreateParameter("User",adVarChar, _
adParamInput, 50, session("CurrentUser"))
params.append .CreateParameter("Comment",adLongVarChar, _
adParamInput, 50, CurrentComment)
params.append .CreateParameter("Time",adVarChar, _
adParamInput, 8, time)
..Execute ,,adExecuteNoRecords
end with

Now, you MAY need to use AppendChunk to set the value of the Comment
parameter. I am not sure. Give this a try without using AppendChunk.

Bob Barrows
--
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.
Jul 19 '05 #17
Ray at <%=sLocation%> wrote:
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:O8**************@TK2MSFTNGP10.phx.gbl...

I'm the opposite. I hate having to look up what the magic numbers
mean. I've got better use for my brainpower than memorizing a bunch
of numbers: especially when the documentation shows their hex values
<grr>


All programmers should be able to look at a hex number or a binary
number and understand it without having to translate it back to the
arbitrary base 10 number system. If you're old school, octets are
also good to know. The key, though, is to not think, "okay, 100101
is, eh, 37." No, it's 100101.


Guess I'm not a programmer ;-)

--
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.
Jul 19 '05 #18
"Ray at <%=sLocation%>" wrote:

adChar?


I think not. Just containing the numeric value 129 is insufficient
justification for using that constant. Given the range of *options* for
CN.Execute(), the only way to interpret 129 is adCmdText +
adExecuteNoRecords (1 + 0x80).
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #19

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

Similar topics

3
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can...
3
by: MX1 | last post by:
I'm ready to pull the hair out of my head. I have a query with a couple of parameters that I want to get from combo boxes on a form. One parameter is a date with a dynamically calculated year and...
3
by: Nicolae Fieraru | last post by:
Hi All, I have a table, tblCustomers, with fields SalutationID and Firstname. I made a query, qrySelect = "Select FirstName from tblCustomers Where SalutationID = " If I run this query by...
0
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
39
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down...
4
by: Mike Dinnis | last post by:
Hi, I've been working through a number of turorials to try to learn more about retrieving data from a SQL database. I think i've mastered techniques where i create a sql string in the page and...
1
by: owengoodhew | last post by:
Guys I need your help/Advice... In my Access Database I have a query (lets say qry1) and in this query i have 2 fields for start and end date, which is provided by 2 Get functions. also i...
4
by: Ranginald | last post by:
Hi, I'm having trouble passing a parameter from my default.aspx page to my default2.aspx page. I have values from a query in a list box and the goal is to pass the "catID" from default.aspx...
11
by: kennthompson | last post by:
Trouble passing mysql table name in php. If I use an existing table name already defined everything works fine as the following script illustrates. <?php function fms_get_info() { $result =...
3
hyperpau
by: hyperpau | last post by:
Hi there guys! I have a Form where there are three comboboxes. This comboboxes are used as references for the parameter of 3 fields in a query. when I hit a command button in my form, it opens...
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
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.