Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: ADODB.Command Object...


Message #1 by "Barry Oxenberg" <oxenberg@m...> on Thu, 14 Sep 2000 14:53:26 -0400
This is a multi-part message in MIME format.



------=_NextPart_000_1AA4_01C01E5B.89B21320

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



Hi!

I am still struggling with this relatively simple database update page I 

am trying to do.  Thanks to Ken's help, I have gotten to the point where 

at least the proper values are being passed to the connnection string 

but the app still bombs out.  Now then, to the point, I did some more 

reading on the web and discovered the 

Server.CreateObject("ADODB.Command") component and am thinking of trying 

to use this in order to make my application work.  In the text I read it 

outlined "defining query parameter configuration information for table 

fields" by using "set objparameter=3Dcm.createparameter(, 200, , 255, 

strValue1)

cm.parameters.append objparam"

and so on for each field in the table where "cm" represents the ADODB 

Command Object,  and strValue1 represents the name of the field in the 

table.  The text also talks about using the "cm" command object to pass 

command text "cm.CommandText =3D"INSERT INTO 'TableName' 

(Value1,Value2,Value3,Value4,Value5) VALUES (?,?,?,?,?)"

By the way, this Command String preceeds the query paramater 

configuration code...anyway, my questions are these:  In the command 

text string, for the "VALUES" do I need to just leave the question marks 

to represent the actual values being inserted in the table (in other 

words, does VBScript know that the values I want to add to the table are 

being passed from the form?), or do I need to declare strings for all 

the variables from the form and replace the question marks with the 

variable names I assigned????

Using the ADODB Command Object, am I required to define the query 

parameter configuration for each field value I want to insert into the 

table?  What do the commas, the "200" and "255" mean???  And what 

exactly does that mean "define query parameter configuration?"



In closing, I read one of the moderator's comments in an e-mail 

yesterday and he mentioned a list for absolute beginners....count me 

in@!!!!!!!!!!!

:-)

Thanks,

Barry






Message #2 by "Ken Schaefer" <ken@a...> on Fri, 15 Sep 2000 11:30:14 +1000
Barry,



Could you post where you're up to now, and what the error is? (ie the error

message, plus the code that's causing the error)



Perhaps it would be best if we could get your app working using just one or

two ADO objects, and then move up to increased levels of complexity :-)



Cheers

Ken

----- Original Message -----

From: "Barry Oxenberg" <oxenberg@m...>

To: "ASP Databases" <asp_databases@p...>

Sent: Friday, September 15, 2000 3:40 PM

Subject: [asp_databases] ADODB.Command Object...





> This is a multi-part message in MIME format.

>

> ------=_NextPart_000_1AA4_01C01E5B.89B21320

> Content-Type: text/plain;

> charset="iso-8859-1"

> Content-Transfer-Encoding: quoted-printable

>

> Hi!

> I am still struggling with this relatively simple database update page I 

> am trying to do.  Thanks to Ken's help, I have gotten to the point where 

> at least the proper values are being passed to the connnection string 

> but the app still bombs out.  Now then, to the point, I did some more 

> reading on the web and discovered the 

> Server.CreateObject("ADODB.Command") component and am thinking of trying 

> to use this in order to make my application work.  In the text I read it 

> outlined "defining query parameter configuration information for table 

> fields" by using "set objparameter=3Dcm.createparameter(, 200, , 255, 

> strValue1)

> cm.parameters.append objparam"

> and so on for each field in the table where "cm" represents the ADODB 

> Command Object,  and strValue1 represents the name of the field in the 

> table.  The text also talks about using the "cm" command object to pass 

> command text "cm.CommandText =3D"INSERT INTO 'TableName' 

> (Value1,Value2,Value3,Value4,Value5) VALUES (?,?,?,?,?)"

> By the way, this Command String preceeds the query paramater 

> configuration code...anyway, my questions are these:  In the command 

> text string, for the "VALUES" do I need to just leave the question marks 

> to represent the actual values being inserted in the table (in other 

> words, does VBScript know that the values I want to add to the table are 

> being passed from the form?), or do I need to declare strings for all 

> the variables from the form and replace the question marks with the 

> variable names I assigned????

> Using the ADODB Command Object, am I required to define the query 

> parameter configuration for each field value I want to insert into the 

> table?  What do the commas, the "200" and "255" mean???  And what 

> exactly does that mean "define query parameter configuration?"

>

> In closing, I read one of the moderator's comments in an e-mail 

> yesterday and he mentioned a list for absolute beginners....count me 

> in@!!!!!!!!!!!

> :-)

> Thanks,

> Barry





Message #3 by "Barry Oxenberg" <oxenberg@m...> on Fri, 15 Sep 2000 12:14:08 -0400
Hello again Ken!

Thanks for your reply....I feel badly continually having to ask for help,

but I just cannot seem to get wrapped around this ASP stuff.  I have been

reading the book, but am only in Chapter 5 and still learning about

declaring variables, arrays and such but need to get this app working in the

meantime.

Getting this app working and then moving on to increased levels of

complexity is perfectly alright with me~!

:-)

Well, today I have a new problem.  First the code:

<!--INCLUDE FILE "adovbs.inc"-->



<%



Dim strDB_CONNECTIONSTRING



strDB_CONNECTIONSTRING = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" &

Server.Mappath("/") & "\data\Aviation Network Inc.mdb" &

"DSN=aviane.Avianet"



Response.Write(strDB_CONNECTIONSTRING)



Dim objRecordset



Set objRecordset = Server.CreateObject("ADODB.Recordset")





objRecordset.Open "ItemDetail", strDB_CONNECTIONSTRING, adOpenForwardOnly,

adLockOptimistic, adCmdTableDirect





objRecordset.AddNew



objRecordset.Fields("PartNumber") = Request.Form("PartNumber")



objRecordset.Fields("Alternate") = Request.Form("Alternate")



objRecordset.Fields("Quantity") = Request.Form("Quantity")



objRecordset.Fields("Condition") = Request.Form("Condition")



objRecordset.Fields("SerialNumber") = Request.Form("SerialNumber")



objRecordset.Fields("Description") = Request.Form("Description")



objRecordset.Fields("Manufacturer") = Request.Form("Manufacturer")



objRecordset.Fields("TR") = Request.Form("TR")



objRecordset.Fields("CR") = Request.Form("CR")



objRecordset.Fields("TagInfo") = Request.Form("TagInfo")



objRecordset.Fields("Date") = Request.Form("Date")



objRecordset.Fields("Location") = Request.Form("Location")



objRecordset.Fields("Status") = Request.Form("Status")



objRecordset.Fields("ListPrice") = Request.Form("ListPrice")



objRecordset.Fields("Trace") = Request.Form("Trace")



objRecordset.Fields("SalePrice") = Request.Form("SalePrice")



objRecordset.Fields("Cost") = Request.Form("Cost")



objRecordset.Fields("OverhaulCost") = Request.Form("OverhaulCost")



objRecordset.Update



objRecordset.Close







Set objRecordset = Nothing



%>







And this is what the browser returns after I fill out the form and press

Submit:



PROVIDER=Microsoft.Jet.OLEDB.4.0;D:\WEBS\aviane\data\Aviation Network

Inc.mdbDSN=aviane.Avianet

Microsoft JET Database Engine error '80004005'



Could not find installable ISAM.



/db_add.asp, line 21



Previously I had not been getting this "ISAM" error.  Before producing this

error, I tried setting my strDB_CONNECTIONSTRING minus the "DSN=" and got an

authentication error, so I added the "DSN=" and now I have this!  How

frustrating.....argggghhhhhhhhhhh!!!!



So, like I said, the connection string seems to get passed ok, but now I am

at a total loss as to what is going wrong.



Heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeelp!!!!!



:-)



Barry







----- Original Message -----

From: "Ken Schaefer" <ken@a...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, September 14, 2000 9:30 PM

Subject: [asp_databases] Re: ADODB.Command Object...





> Barry,

>

> Could you post where you're up to now, and what the error is? (ie the

error

> message, plus the code that's causing the error)

>

> Perhaps it would be best if we could get your app working using just one

or

> two ADO objects, and then move up to increased levels of complexity :-)

>

> Cheers

> Ken






  Return to Index