pradeepy
asked on
Cursorlocation property - adUseclient undefined error
Hi experts,
i have a login form(loginform.asp) and when i click on the login form by giving password and username it is giving the following error as
Variable is undefined: 'adUseClient'
/AFI-Agents/include_io/io_ support_pa ge.asp, line 45
The code in line 45 is objConn.CursorLocation=adU seClient.
Can anyone tell me how to correct this error and display my form(mainform.asp).
Any questions,comments and furthur readings are welcome.
Thanks in advance
i have a login form(loginform.asp) and when i click on the login form by giving password and username it is giving the following error as
Variable is undefined: 'adUseClient'
/AFI-Agents/include_io/io_
The code in line 45 is objConn.CursorLocation=adU
Can anyone tell me how to correct this error and display my form(mainform.asp).
Any questions,comments and furthur readings are welcome.
Thanks in advance
Here are the numbers:
adUseNone -1- OBSOLETE (appears only for backward compatibility). Does not use cursor services
adUseServer- 2 -Default. Uses a server-side cursor
adUseClient -3- Uses a client-side cursor supplied by a local cursor library. For backward compatibility, the synonym adUseClientBatch is also supported
So you would use:
objConn.CursorLocation=3
adUseNone -1- OBSOLETE (appears only for backward compatibility). Does not use cursor services
adUseServer- 2 -Default. Uses a server-side cursor
adUseClient -3- Uses a client-side cursor supplied by a local cursor library. For backward compatibility, the synonym adUseClientBatch is also supported
So you would use:
objConn.CursorLocation=3
ASKER
Hi alorentz,
i have corrected the code to objConn.CursorLocation=3, but now when iam connecting to database iam getting the following error
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/AFI-Agents/include_io/io_ support_pa ge.asp, line 62
Can you please let me know how to correct this error also.
Thanks in advance
i have corrected the code to objConn.CursorLocation=3, but now when iam connecting to database iam getting the following error
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/AFI-Agents/include_io/io_
Can you please let me know how to correct this error also.
Thanks in advance
I'm guessing you are using the Microsoft Access driver, but you should use the OLEDB Jet driver.
http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForMicrosoftJet
oConn.Open "Provider=Microsoft.Jet.OL EDB.4.0;Da ta Source=c:\somepath\myDb.md b;"
http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForMicrosoftJet
oConn.Open "Provider=Microsoft.Jet.OL
Either way:
Post the code block for the connection and query...
Post the code block for the connection and query...
ASKER
Hi alorentz,
the code is as shown below iam using SQL Server
Application("sta_Connect_S
The full code ia as shown below
--------------------------
Sub Application_OnStart
Application.Lock
Application("staSite_Name"
Application("staApp_Root")
' Production....ish
' Application("staJAG_Connec
' Centex Dev database
' Application("staJAG_Connec
'Existing connection string
' Application("sta_Connect_S
''Application("sta_Connect
Application("sta_Connect_S
Application("staReport_Fol
Application.Unlock
'strConn = "DRIVER={Microsoft ODBC for Oracle}; SERVER=DatabaseAlias; UID=UserID; PWD=Password
End Sub
Sub Session_OnStart
Dim strCurrent_Page, strLogin_Form, strKU_Login, strTimed_Out_Page
Dim strMain_Frameset_Page
strLogin_Form = "/" & Application("staSite_Name"
strTimed_Out_Page = "/" & Application("staSite_Name"
strMain_Frameset_Page = "/" & Application("staSite_Name"
strCurrent_Page = Request.ServerVariables("S
If UCase(Trim(strCurrent_Page
UCase(Trim(strCurrent_Page
UCase(Trim(strCurrent_Page
Exit Sub
End if
End Sub
Thanks in advance
Ohhh....SQL Server huh. What line is causing the error, or where is it occuring. Can you get a connection to work at all anywhere?
ASKER
Hi
it is showing error on line 5
Sub Application_OnStart
1.) Application.Lock
2.)Application("staSite_Na
3.)Application("staApp_Roo
4.)Password=pk2allaccess"
5.)Application("sta_Connec
6.)Application("staReport_
7.)Application.Unlock
End Sub
That's not possible to have an error there? You are just assigning an Application variable. Are you sure that is where the error is?
This would cause an error if anything:
4.)Password=pk2allaccess" '<-----------extra quote
This would cause an error if anything:
4.)Password=pk2allaccess" '<-----------extra quote
ASKER
Hi sorry the page is showing error on line 8
Function gmOpen_Connection(objADO, objConn, strMod_Name)
Dim sConn_String, sql, strMsg, strApp_Var
strApp_Var = "sta_Connect_String"
sConn_String =gmGet_App_State(strApp_Va
Err.clear
Set objConn = Server.CreateObject("ADODB
objConn.CursorLocation = 3
If Err.Number <> 0 then
strMsg = "Database error creating a connection object when from " & strMod_Name
Call gmLog_SQL_Error (strMsg, sql, objConn, strMod_Name)
Exit function
End if
objConn.ConnectionTimeout = 30
objConn.CommandTimeout = 90
objConn.Errors.Clear
Err.clear
--------------------------
8.) objConn.Open sConn_String
--------------------------
If Err.Number <> 0 then
strMsg = "Database error opening a connection when called from " & strMod_Name
sql = "SQL Statement: Opening connection."
Call gmLog_SQL_Error(strMsg, sql, objConn, strMod_Name)
exit function
End if
End Function
Then what does this function do? Not sure why you are using this:
gmGet_App_State(strApp_Var , "String")
'''''''''''''''''''''''''' '''''''''' ''''''
Why not just use the application variable you set up originally, that is what its for:
sConn_String = Application("sta_Connect_S tring")
OR
sConn_String = "Provider=SQLOLEDB; Data Source=JDP01DB0609; Initial Catalog=AFIClaims; User ID=PK3_Operator; Password=pk2allaccess"
gmGet_App_State(strApp_Var
''''''''''''''''''''''''''
Why not just use the application variable you set up originally, that is what its for:
sConn_String = Application("sta_Connect_S
OR
sConn_String = "Provider=SQLOLEDB; Data Source=JDP01DB0609; Initial Catalog=AFIClaims; User ID=PK3_Operator; Password=pk2allaccess"
ASKER
Hi ,
i have the following code, when i put response.write(Application (strpassed _val) at the starting it is returning the correct application variable value
Function gmGet_App_State(strPassed_ Val, strVal_Type)
response.write(Application (strpassed _val)
if Trim(Application(strPassed _Val) & "") = "" then
Select Case strVal_Type
Case "String"
gmGet_App_State = ""
Case Else
gmGet_App_State = 0
End Select
else
gmGet_App_State = Application(strPassed_Val) .Value
end if
End Function
i have the following code, when i put response.write(Application
Function gmGet_App_State(strPassed_
response.write(Application
if Trim(Application(strPassed
Select Case strVal_Type
Case "String"
gmGet_App_State = ""
Case Else
gmGet_App_State = 0
End Select
else
gmGet_App_State = Application(strPassed_Val)
end if
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OR use the nuber for cursor location:
objConn.CursorLocation=1