Creating ADO recordset w/o database .Append not working correctly IIS5 win2000 Prof not .Net 
Author Message
 Creating ADO recordset w/o database .Append not working correctly IIS5 win2000 Prof not .Net

Error Type:
Microsoft VBScript runtime (0x800A01F4)
Variable is undefined: 'adVarChar'
/asp/trucking/e/BuildAndShowChart.asp, line 68

I think I am missing recognized constants.  Is this part of .NET????  I
didn't think so.

Any thoughts on what I am doing wrong?



Sun, 21 Nov 2004 09:43:53 GMT  
 Creating ADO recordset w/o database .Append not working correctly IIS5 win2000 Prof not .Net
Are you trying to add a column to a table via adox?

--
Han Pohwan
Seoul, Korea, MS Asia MVP

Quote:
> Error Type:
> Microsoft VBScript runtime (0x800A01F4)
> Variable is undefined: 'adVarChar'
> /asp/trucking/e/BuildAndShowChart.asp, line 68

> I think I am missing recognized constants.  Is this part of .NET????  I
> didn't think so.

> Any thoughts on what I am doing wrong?



Sun, 21 Nov 2004 13:19:09 GMT  
 Creating ADO recordset w/o database .Append not working correctly IIS5 win2000 Prof not .Net
Honestly I don't know what that is, I am a Coldfusion Programmer who has to
put an application on an ASP box, and fumbling around trying to do it! I
just bought a couple of WROX books so hopefully I can get caught up.

I am trying to Create a Record Set that I am going to pass to a componant
that uses excel to do charting. Essentially I am trying to run the testing
pages that came with the componant.

So here is what is going on. . .

Dim oRs

Dim oConnection

Dim strQuery

'--- recordset from database

if( flgRSFromDatabase = true ) then

'--- create the connection object

Set oConnection = Server.CreateObject("ADODB.Connection" )

'--- open the connection

oConnection.Open "Driver={SQL Server}; Server=(local); Database=CHARTDATA;
UID=sa; PWD=sa"

'--- build the query string

strQuery = "SELECT * FROM yearly_production WHERE
factory_name='"+strFactory+"' AND production_year BETWEEN
"+CStr(iStartYear)+" AND "+CStr(iEndYear)

'--- get the data in recordset

Set oRs = oConnection.Execute( strQuery )

'--- check if data is there

if( oRs.EOF ) then

Response.Write( "No data available" )

Response.End

end if

'--- recordset thru scripting

else

'--- create a recordset object

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

with oRs

.CursorLocation = 3 '--- client-side cursor

with .Fields

.Append "factory_name", adVarChar, 25

.Append "production_year",adInteger

.Append "production_in_tons",adInteger

end with

.Open '-- open the recordset

'--- add records

.AddNew Array("factory_name","production_year", "production_in_tons"),
Array( strFactory, iStartYear, "50" )

.AddNew Array("factory_name","production_year", "production_in_tons"),
Array( strFactory, iStartYear+1, "160" )

.AddNew Array("factory_name","production_year", "production_in_tons"),
Array( strFactory, iStartYear+2, "90" )

.AddNew Array("factory_name","production_year", "production_in_tons"),
Array( strFactory, iStartYear+3, "120" )

.AddNew Array("factory_name","production_year", "production_in_tons"),
Array( strFactory, iStartYear+4, "200" )

'--- update

.Update

end with

end if

Any thoughts?

-Rex


Quote:
> Are you trying to add a column to a table via adox?

> --
> Han Pohwan
> Seoul, Korea, MS Asia MVP


> > Error Type:
> > Microsoft VBScript runtime (0x800A01F4)
> > Variable is undefined: 'adVarChar'
> > /asp/trucking/e/BuildAndShowChart.asp, line 68

> > I think I am missing recognized constants.  Is this part of .NET????  I
> > didn't think so.

> > Any thoughts on what I am doing wrong?



Mon, 22 Nov 2004 02:54:32 GMT  
 Creating ADO recordset w/o database .Append not working correctly IIS5 win2000 Prof not .Net
:: Error Type:
:: Microsoft VBScript runtime (0x800A01F4)
:: Variable is undefined: 'adVarChar'
:: /asp/trucking/e/BuildAndShowChart.asp, line 68
::
::
:: I think I am missing recognized constants.  Is this part of .NET????
:: I didn't think so.
::
:: Any thoughts on what I am doing wrong?

Define the adWhatever named values as local Const adWhatever = 123

or include the adovbs.inc file (or copy/paste from it).

C:\Program Files\Common Files\System\ado\adovbs.inc

'---- DataTypeEnum Values ----
Const adEmpty = 0
Const adTinyInt = 16
Const adSmallInt = 2
Const adInteger = 3
Const adBigInt = 20
Const adUnsignedTinyInt = 17
Const adUnsignedSmallInt = 18
Const adUnsignedInt = 19
Const adUnsignedBigInt = 21
Const adSingle = 4
Const adDouble = 5
Const adCurrency = 6
Const adDecimal = 14
Const adNumeric = 131
Const adBoolean = 11
Const adError = 10
Const adUserDefined = 132
Const adVariant = 12
Const adIDispatch = 9
Const adIUnknown = 13
Const adGUID = 72
Const adDate = 7
Const adDBDate = 133
Const adDBTime = 134
Const adDBTimeStamp = 135
Const adBSTR = 8
Const adChar = 129
Const adVarChar = 200
Const adLongVarChar = 201
Const adWChar = 130
Const adVarWChar = 202
Const adLongVarWChar = 203
Const adBinary = 128
Const adVarBinary = 204
Const adLongVarBinary = 205
Const adChapter = 136
Const adFileTime = 64
Const adPropVariant = 138
Const adVarNumeric = 139
Const adArray = &H2000

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Mon, 22 Nov 2004 12:43:20 GMT  
 Creating ADO recordset w/o database .Append not working correctly IIS5 win2000 Prof not .Net
Rex.

Just now Michael's nice recommandation is there. Named constants like
/advarchar/ sometimes fail in asp. So try numbers instead of the words.

Anyway the code is not so efficient and not easy to debug if problem occurs.
You retrieve a recordset, make a new recordset, and insert data into a new
recordset. i.e. for the second part,

oConnection.execute "create table tableX (factory_name varchar(25),
production_year int, production_in_tons int)"

That one line standard sql will be easier. For inserting part, I'll also
prefer sql rather than /addnew/ method. Anyway only if problem persists,
reply again please.

--
Han Pohwan
Seoul, Korea, MS Asia MVP

Quote:
> Honestly I don't know what that is, I am a Coldfusion Programmer who has
to
> put an application on an ASP box, and fumbling around trying to do it! I
> just bought a couple of WROX books so hopefully I can get caught up.

> I am trying to Create a Record Set that I am going to pass to a componant
> that uses excel to do charting. Essentially I am trying to run the testing
> pages that came with the componant.

> So here is what is going on. . .

> Dim oRs

> Dim oConnection

> Dim strQuery

> '--- recordset from database

> if( flgRSFromDatabase = true ) then

> '--- create the connection object

> Set oConnection = Server.CreateObject("ADODB.Connection" )

> '--- open the connection

> oConnection.Open "Driver={SQL Server}; Server=(local); Database=CHARTDATA;
> UID=sa; PWD=sa"

> '--- build the query string

> strQuery = "SELECT * FROM yearly_production WHERE
> factory_name='"+strFactory+"' AND production_year BETWEEN
> "+CStr(iStartYear)+" AND "+CStr(iEndYear)

> '--- get the data in recordset

> Set oRs = oConnection.Execute( strQuery )

> '--- check if data is there

> if( oRs.EOF ) then

> Response.Write( "No data available" )

> Response.End

> end if

> '--- recordset thru scripting

> else

> '--- create a recordset object

> Set oRs = Server.CreateObject("ADODB.Recordset" )

> with oRs

> .CursorLocation = 3 '--- client-side cursor

> with .Fields

> .Append "factory_name", adVarChar, 25

> .Append "production_year",adInteger

> .Append "production_in_tons",adInteger

> end with

> .Open '-- open the recordset

> '--- add records

> .AddNew Array("factory_name","production_year", "production_in_tons"),
> Array( strFactory, iStartYear, "50" )

> .AddNew Array("factory_name","production_year", "production_in_tons"),
> Array( strFactory, iStartYear+1, "160" )

> .AddNew Array("factory_name","production_year", "production_in_tons"),
> Array( strFactory, iStartYear+2, "90" )

> .AddNew Array("factory_name","production_year", "production_in_tons"),
> Array( strFactory, iStartYear+3, "120" )

> .AddNew Array("factory_name","production_year", "production_in_tons"),
> Array( strFactory, iStartYear+4, "200" )

> '--- update

> .Update

> end with

> end if

> Any thoughts?

> -Rex



> > Are you trying to add a column to a table via adox?

> > --
> > Han Pohwan
> > Seoul, Korea, MS Asia MVP


> > > Error Type:
> > > Microsoft VBScript runtime (0x800A01F4)
> > > Variable is undefined: 'adVarChar'
> > > /asp/trucking/e/BuildAndShowChart.asp, line 68

> > > I think I am missing recognized constants.  Is this part of .NET????
I
> > > didn't think so.

> > > Any thoughts on what I am doing wrong?



Mon, 22 Nov 2004 14:03:44 GMT  
 Creating ADO recordset w/o database .Append not working correctly IIS5 win2000 Prof not .Net
Rex,
Try and include adovbs.inc. That or as previously mentioned, change the
named constants to the numbers they represent.

Yuri


Quote:
> Error Type:
> Microsoft VBScript runtime (0x800A01F4)
> Variable is undefined: 'adVarChar'
> /asp/trucking/e/BuildAndShowChart.asp, line 68

> I think I am missing recognized constants.  Is this part of .NET????  I
> didn't think so.

> Any thoughts on what I am doing wrong?



Thu, 25 Nov 2004 09:59:26 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. database app does not work well on win2000????

2. database app does not work well on win2000???

3. Database app can not work well on win2000?

4. ADO Update event does not work correctly

5. ADO SP ReturnValue Params not working and problems with Command.Append

6. MSWINSCK.OCX ...not correctly registered (WIN2000)

7. Append Query Isn't Working Correctly

8. Append Query Isn't Working Correctly

9. Access Violation crviewer.dll IE6 SP1 IIS5 Win2000

10. psnup seams not to work correctly

11. Server side VBScript and Netscape not working correctly.

12. CDbl does not work correctly

 

 
Powered by phpBB® Forum Software