Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

***Urgent Help Requested***

Status
Not open for further replies.

dsk525

Programmer
Mar 13, 2002
73
0
0
US
Hi,

I am trying to create a system DSN for the asp pages, however, I am getting to following run time error on the front end (browser):

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
/form/LoginProcess.asp, line 46


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Page:
GET /form/LoginProcess.asp

HERE is my ASP code where the problem may be:

Dim strUserName
Dim strPassword
Dim strSQLStatement
Dim DataConn
Dim rsPasswordFile
Dim cmdDC
Dim tempInt
strUserName = Request.QueryString("UserName")
strPassword = Request.QueryString("Password")

strSQLStatement = "Select * from LoginInfo where UserName = '" _
+ strUserName + "' and PasswordFld = '" + strPassword + "'"

set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open "DSN=HeminiWebDSN"

Set cmdDC = Server.CreateObject("ADODB.Command")
cmdDC.ActiveConnection = DataConn
cmdDC.CommandText = strSQLStatement
cmdDC.CommandType = 1


set rsPasswordFile = Server.CreateObject("ADODB.Recordset")
rsPasswordFile.Open cmdDC, , 0', 1


Thank you for your help in advance!
 
try this, works fine with me:

set conn = server.createobject("ADODB.Connection")
conn.open "DSN=myDSN"

sqltext = "select * from myTable"

conn.execute(sqltext)


 
TRy with this code

set con=server.createobject("adodb.connection")
con.open ("FILEDSN=C:\Program Files\Common Files\ODBC\Data Sources\tool1.DSN")
 
Just change the Your_RecordSet_Name and simular text to the requested details , paste the modified code into your ASP Page and you are all set.

<%
' NOTE: There is NO space between rs and Your_RecordSet_Name

Dim rsYour_RecordSet_Name
Dim rsYour_RecordSet_Name_numRows

Set rsYour_RecordSet_Name = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsYour_RecordSet_Name.ActiveConnection = Your_ODBC/DSN_Name_on_the_server
rsYour_RecordSet_Name.Source = &quot;Your SQL query here&quot;
rsYour_RecordSet_Name.CursorType = 0
rsYour_RecordSet_Name.CursorLocation = 2
rsYour_RecordSet_Name.LockType = 1
rsYour_RecordSet_Name.Open()

rsYour_RecordSet_Name_numRows = 0
%>


Please mark this as helpful if it was.

Thank you,
Charlie
 
Just want to add...

The other two methods are fine, but they are no good in a development environment, because you don't have a RecordSet (rs) to work with while building your pages.

It all comes down to preference.

Good Luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top