Asp to MSAcess connection?

This is a discussion on "Asp to MSAcess connection?" within the Classic ASP section. This forum, and the thread "Asp to MSAcess connection? are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Nov 8th, 2005, 19:49
Junior Member
Join Date: Nov 2005
Age: 55
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Asp to MSAcess connection?

Hello to everybody

I am new in your forum and I have read almost all relative posts but still can not find a solution. So Please help

I have the site http://www.easytraveller.gr

I have uploaded in the db directory the file herdb.mdb and the file Connection1.asp in the wwwroot directory
I want to use the connection file to connect to the database and there execute recordsets at the file acropole_delphi.asp (This page is made with Dreamweaver)

The code in the connection1.asp is

Dim strConn
Set strConn = Server.CreateObject("ADODB.Connection")
strConn="DRIVER={Microsoft Access Driver (*.mdb)}; "
strConn=strConn & "DBQ=" & Server.mappath("/db/herdb.mdb")

The code in the operational file the acropole_delphi.asp (the biggining and the code for the first recordset ) is

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connection1.asp" -->
<%
Dim rsMonths
Dim rsMonths_numRows

Set rsMonths = Server.CreateObject("ADODB.Recordset")
rsMonths.ActiveConnection = MM_Connection1_STRING
rsMonths.Source = "SELECT MONTH FROM MONTHS"
rsMonths.CursorType = 0
rsMonths.CursorLocation = 2
rsMonths.LockType = 1
rsMonths.Open()

rsMonths_numRows = 0
%>


When I try to see the file (on the internet) I am getting error message :

ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/acropole_delphi.asp, line 8

The /acropole_delphi.asp, line 8 is this one :

rsMonths.ActiveConnection = MM_Connection1_STRING

Can someone tell me where I make a mistake? My opinion is that I get connection with the database and the problem is after the connection

Best regards
Tolis
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Nov 9th, 2005, 08:09
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Asp to MSAcess connection?

Code: Select all
<%
'--------------------------------------------------------------------
' Microsoft ADO
'
' (c) 1996 Microsoft Corporation.  All Rights Reserved.
'
'
'
' ADO constants include file for VBScript
'
'--------------------------------------------------------------------

'---- CursorTypeEnum Values ----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3

'---- CursorOptionEnum Values ----
Const adHoldRecords = &H00000100
Const adMovePrevious = &H00000200
Const adAddNew = &H01000400
Const adDelete = &H01000800
Const adUpdate = &H01008000
Const adBookmark = &H00002000
Const adApproxPosition = &H00004000
Const adUpdateBatch = &H00010000
Const adResync = &H00020000
Const adNotify = &H00040000

'---- LockTypeEnum Values ----
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4

'---- ExecuteOptionEnum Values ----
Const adRunAsync = &H00000010

'---- ObjectStateEnum Values ----
Const adStateClosed = &H00000000
Const adStateOpen = &H00000001
Const adStateConnecting = &H00000002
Const adStateExecuting = &H00000004

'---- CursorLocationEnum Values ----
Const adUseServer = 2
Const adUseClient = 3

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

'---- FieldAttributeEnum Values ----
Const adFldMayDefer = &H00000002
Const adFldUpdatable = &H00000004
Const adFldUnknownUpdatable = &H00000008
Const adFldFixed = &H00000010
Const adFldIsNullable = &H00000020
Const adFldMayBeNull = &H00000040
Const adFldLong = &H00000080
Const adFldRowID = &H00000100
Const adFldRowVersion = &H00000200
Const adFldCacheDeferred = &H00001000

'---- EditModeEnum Values ----
Const adEditNone = &H0000
Const adEditInProgress = &H0001
Const adEditAdd = &H0002
Const adEditDelete = &H0004

'---- RecordStatusEnum Values ----
Const adRecOK = &H0000000
Const adRecNew = &H0000001
Const adRecModified = &H0000002
Const adRecDeleted = &H0000004
Const adRecUnmodified = &H0000008
Const adRecInvalid = &H0000010
Const adRecMultipleChanges = &H0000040
Const adRecPendingChanges = &H0000080
Const adRecCanceled = &H0000100
Const adRecCantRelease = &H0000400
Const adRecConcurrencyViolation = &H0000800
Const adRecIntegrityViolation = &H0001000
Const adRecMaxChangesExceeded = &H0002000
Const adRecObjectOpen = &H0004000
Const adRecOutOfMemory = &H0008000
Const adRecPermissionDenied = &H0010000
Const adRecSchemaViolation = &H0020000
Const adRecDBDeleted = &H0040000

'---- GetRowsOptionEnum Values ----
Const adGetRowsRest = -1

'---- PositionEnum Values ----
Const adPosUnknown = -1
Const adPosBOF = -2
Const adPosEOF = -3

'---- enum Values ----
Const adBookmarkCurrent = 0
Const adBookmarkFirst = 1
Const adBookmarkLast = 2

'---- MarshalOptionsEnum Values ----
Const adMarshalAll = 0
Const adMarshalModifiedOnly = 1

'---- AffectEnum Values ----
Const adAffectCurrent = 1
Const adAffectGroup = 2
Const adAffectAll = 3

'---- FilterGroupEnum Values ----
Const adFilterNone = 0
Const adFilterPendingRecords = 1
Const adFilterAffectedRecords = 2
Const adFilterFetchedRecords = 3
Const adFilterPredicate = 4

'---- SearchDirection Values ----
Const adSearchForward = 1
Const adSearchBackward = -1

'---- ConnectPromptEnum Values ----
Const adPromptAlways = 1
Const adPromptComplete = 2
Const adPromptCompleteRequired = 3
Const adPromptNever = 4

'---- ConnectModeEnum Values ----
Const adModeUnknown = 0
Const adModeRead = 1
Const adModeWrite = 2
Const adModeReadWrite = 3
Const adModeShareDenyRead = 4
Const adModeShareDenyWrite = 8
Const adModeShareExclusive = &Hc
Const adModeShareDenyNone = &H10

'---- IsolationLevelEnum Values ----
Const adXactUnspecified = &Hffffffff
Const adXactChaos = &H00000010
Const adXactReadUncommitted = &H00000100
Const adXactBrowse = &H00000100
Const adXactCursorStability = &H00001000
Const adXactReadCommitted = &H00001000
Const adXactRepeatableRead = &H00010000
Const adXactSerializable = &H00100000
Const adXactIsolated = &H00100000

'---- XactAttributeEnum Values ----
Const adXactCommitRetaining = &H00020000
Const adXactAbortRetaining = &H00040000

'---- PropertyAttributesEnum Values ----
Const adPropNotSupported = &H0000
Const adPropRequired = &H0001
Const adPropOptional = &H0002
Const adPropRead = &H0200
Const adPropWrite = &H0400

'---- ErrorValueEnum Values ----
Const adErrInvalidArgument = &Hbb9
Const adErrNoCurrentRecord = &Hbcd
Const adErrIllegalOperation = &Hc93
Const adErrInTransaction = &Hcae
Const adErrFeatureNotAvailable = &Hcb3
Const adErrItemNotFound = &Hcc1
Const adErrObjectInCollection = &Hd27
Const adErrObjectNotSet = &Hd5c
Const adErrDataConversion = &Hd5d
Const adErrObjectClosed = &He78
Const adErrObjectOpen = &He79
Const adErrProviderNotFound = &He7a
Const adErrBoundToCommand = &He7b
Const adErrInvalidParamInfo = &He7c
Const adErrInvalidConnection = &He7d
Const adErrStillExecuting = &He7f
Const adErrStillConnecting = &He81

'---- ParameterAttributesEnum Values ----
Const adParamSigned = &H0010
Const adParamNullable = &H0040
Const adParamLong = &H0080

'---- ParameterDirectionEnum Values ----
Const adParamUnknown = &H0000
Const adParamInput = &H0001
Const adParamOutput = &H0002
Const adParamInputOutput = &H0003
Const adParamReturnValue = &H0004

'---- CommandTypeEnum Values ----
Const adCmdUnknown = &H0008
Const adCmdText = &H0001
Const adCmdTable = &H0002
Const adCmdStoredProc = &H0004

'---- SchemaEnum Values ----
Const adSchemaProviderSpecific = -1
Const adSchemaAsserts = 0
Const adSchemaCatalogs = 1
Const adSchemaCharacterSets = 2
Const adSchemaCollations = 3
Const adSchemaColumns = 4
Const adSchemaCheckConstraints = 5
Const adSchemaConstraintColumnUsage = 6
Const adSchemaConstraintTableUsage = 7
Const adSchemaKeyColumnUsage = 8
Const adSchemaReferentialContraints = 9
Const adSchemaTableConstraints = 10
Const adSchemaColumnsDomainUsage = 11
Const adSchemaIndexes = 12
Const adSchemaColumnPrivileges = 13
Const adSchemaTablePrivileges = 14
Const adSchemaUsagePrivileges = 15
Const adSchemaProcedures = 16
Const adSchemaSchemata = 17
Const adSchemaSQLLanguages = 18
Const adSchemaStatistics = 19
Const adSchemaTables = 20
Const adSchemaTranslations = 21
Const adSchemaProviderTypes = 22
Const adSchemaViews = 23
Const adSchemaViewColumnUsage = 24
Const adSchemaViewTableUsage = 25
Const adSchemaProcedureParameters = 26
Const adSchemaForeignKeys = 27
Const adSchemaPrimaryKeys = 28
Const adSchemaProcedureColumns = 29
%>

copy the above, save it into a file called "adovbs.inc" and include this file in your page:

Code: Select all
<!--#include file="adovbs.inc" -->
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Nov 10th, 2005, 21:40
Junior Member
Join Date: Nov 2005
Age: 55
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Asp to MSAcess connection?

Thank you Sam

I have created the file and uploaded to the wwwroot directory
The code (Part of it)of my asp page is like :

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="adovbs.inc" -->
<%
Dim rsMonths
Dim rsMonths_numRows
Set rsMonths = Server.CreateObject("ADODB.Recordset")
rsMonths.ActiveConnection = MM_adovbs_STRING
rsMonths.Source = "SELECT MONTH FROM MONTHS"
rsMonths.CursorType = 0
rsMonths.CursorLocation = 2
rsMonths.LockType = 1
rsMonths.Open()
rsMonths_numRows = 0
%>

Trying to see the page in the internet I am getting the error message



ADODB.Recordseterror '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. /acropole_delphi.asp, line 8

The line in error is

rsMonths.ActiveConnection = MM_adovbs_STRING


Can you please tell me what I have to wright in this line (What is the ActiveConnection? since this is the line where the program stops

Thank you again
Tolis
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Nov 11th, 2005, 11:51
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Asp to MSAcess connection?

oh right, in that case i think you should have:

Code: Select all
rsMonths.ActiveConnection = strConn
instead of MM_adovbs_STRING
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Nov 12th, 2005, 17:34
Junior Member
Join Date: Nov 2005
Age: 55
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Asp to MSAcess connection?

Thank you Sam
I have created the file and uploaded to the server and now everything is working fine
The basic mistake was in the connectionstring. Now my Connection1.asp file looks like
Code: Select all
<%
' FileName="Connection_ado_conn_string.htm"
' Type="ADO" 
' DesigntimeType="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
Dim MM_Connection1_STRING
MM_Connection1_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("..\db\herdb.mdb") & ";Persist Security Info=False"
%>
 
and the connection in the .asp file lookes like
 
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/Connection1.asp" -->
<!--#include file="adovbs.inc" -->
<%
Dim rsYears
Dim rsYears_numRows
Set rsYears = Server.CreateObject("ADODB.Recordset")
rsYears.ActiveConnection = MM_Connection1_STRING
rsYears.Source = "SELECT YEAR FROM YEARS"
rsYears.CursorType = 0
rsYears.CursorLocation = 2
rsYears.LockType = 1
rsYears.Open()
rsYears_numRows = 0
%>
Thank you again
Best regards
Tolis

Last edited by Rob; Nov 14th, 2005 at 12:25. Reason: PLEASE USE [CODE] [/CODE] TAGS
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Nov 14th, 2005, 12:11
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Asp to MSAcess connection?

Cool, glad you got it working
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Oct 19th, 2007, 07:12
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Asp to MSAcess connection?

There should be a better way to do this and not to mention a much more effective and fast way...
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
asp, msacess, connection

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic DSN-Less Connection to DB Corey Bryant Classic ASP 7 Oct 26th, 2007 06:08
ODBC connection go4kpo PHP Forum 2 Jul 10th, 2007 14:20
PHP n MySQL connection uddin PHP Forum 1 Apr 18th, 2007 06:41
DB connection problem Strike Classic ASP 1 Jul 4th, 2006 09:45
Database connection fogofogo Classic ASP 7 Dec 5th, 2005 14:25


All times are GMT. The time now is 14:47.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42