Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 12-06-2004, 01:57 PM ASP Function
barbara's Avatar
Skilled Talker

Posts: 79
Trades: 0
this is the error message i got: Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.
/project/Verify.asp, line 13 (line 13 is this: myDSN = "DSN=HTC"


below is my code:

<%
'Cks to see if value is in table. Returns a -1 if update, 0 if need to add record
Function CkExistence (sqlstring)

Dim rscount ' The recordset object
Dim myDSN
Dim conn

myDSN = "DSN=HTC;"

'Opens a connection object
set conn = Server.CreateObject("ADODB.Connection")
conn.open myDSN

set rscount=conn.execute(sqlstring)

if rscount.eof then
ckexistence = 0
else
ckexistence = -1
end if


End Function
%>

<%
'Declare all local variables
Dim conn, strSQL, strSQLtest, rs
msg = 0
strSQLtest = "SELECT CustID FROM tblCustomers where CustUserid = '" & Request("txtUserid") & "'"
'Check to see if values exist
if CkExistence(strSQLtest) = 0 then
'A record does not exist currently.
msg = 1
response.redirect "login.asp?msg=" & msg

else
'A record exists. Verify password.

strSQLtest = "SELECT CustID FROM tblCustomers where CustUserid = '" & Request("txtUserid") & "' and Password = '" & request("txtPassword") & "'"

if CkExistence(strSQLtest) = 0 then
'Your password is not valid.
msg = 2
response.redirect "login.asp?msg=" & msg


else
'Your password and userid are valid. Get the custID.
strSQL = "SELECT * FROM tblCustomers where CustUserid = '" & Request("txtUserid") & "' and Password = '" & request("txtPassword") & "'"

'Opens a connection object
set conn = Server.CreateObject("ADODB.Connection")
conn.open "C:/Inetpub/wwwroot/database/HTC.mdb"
set RS=Server.CreateObject("adodb.recordset")
RS.open strSQL, conn


if not rs.eof then
'Read the custid
custid=CStr(RS("CustID"))

'Go to the next display.
response.redirect "htc-test-request_form.asp?customerid=" & custid
end if

end if
end if

%>

sorry for the long code, but i think it will be clearer if i post the complete code. was my function syntax incorrect?

thanks
barbara is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-07-2004, 12:35 AM
WebcyteDesign's Avatar
Registered User

Posts: 159
Location: Hamilton
Trades: 0
Test your DSN. You can do this by creating a file inside notepad, call it test.udl and leave it blank inside. When you double click on it you will be able to go through the steps to make sure that you are able to connection to your database. After you have gone through and tested it you can open the file in notepad and it should give you your connection string to use. Try it out, I use it all the time.
WebcyteDesign is offline
Reply With Quote
View Public Profile Visit WebcyteDesign's homepage!
 
Old 12-07-2004, 10:25 AM
barbara's Avatar
Skilled Talker

Posts: 79
Trades: 0
needs clarification:

when i create the test.udl file. after selecting "connection string" which Data Source do i choose?

- File Data Source or Machine Data Source

I didn't know so i chose the Machine data Source since it show the name of my database as a selection.

thanks
barbara is offline
Reply With Quote
View Public Profile
 
Old 12-07-2004, 08:42 PM
WebcyteDesign's Avatar
Registered User

Posts: 159
Location: Hamilton
Trades: 0
a file dsn is an actual file with a dsn extension that you have created. A machine dsn is stored on the machine, most people use the machine dsn but having a file dsn can have some great benefits.
WebcyteDesign is offline
Reply With Quote
View Public Profile Visit WebcyteDesign's homepage!
 
Old 01-04-2005, 06:11 PM Help Resources!
Junior Talker

Posts: 1
Trades: 0
I got the same problem. I use Dreamwave to design Web. The same code works on my laptop(Win 2K) but fails to run on my desktop(XP). I just found the following URL that maybe have some help. I havn't try it.

http://www.webwizguide.info/asp/faq/...tabase_faq.asp

If anyone has more information, please let me know.
unicool is offline
Reply With Quote
View Public Profile
 
Old 01-04-2005, 09:29 PM
vivekar's Avatar
Webmaster Talker

Posts: 612
Trades: 0
Use File DSN.

Choose the correct path for the database.

I prefer the filepath method instead of DSN.

Checkout this thread for a subroutine
http://www.webmaster-talk.com/showth...hlight=gblConn
__________________

Please login or register to view this content. Registration is FREE
(Active since 2003) |
Please login or register to view this content. Registration is FREE
vivekar is offline
Reply With Quote
View Public Profile Visit vivekar's homepage!
 
Old 01-17-2005, 11:02 PM
Bullschmidt's Avatar
Average Talker

Posts: 24
Location: USA
Trades: 0
And here's a related resource:

Why do I get database-related 80004005 errors?
http://www.aspfaq.com/show.asp?id=2009
__________________
J. Paul Schmidt

Please login or register to view this content. Registration is FREE
- Freelance Web and Database Developer

Please login or register to view this content. Registration is FREE
- Classic ASP Design Tips
Bullschmidt is offline
Reply With Quote
View Public Profile Visit Bullschmidt's homepage!
 
Reply     « Reply to ASP Function
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18398 seconds with 12 queries