Forum Moderators: open

Message Too Old, No Replies

creating a dsnless connection

         

danlott

10:45 am on Apr 16, 2004 (gmt 0)

10+ Year Member



hi all, can someone have a look at this for me? i want to create a dsnless connection. i have:

var rsNews = Server.CreateObject("ADODB.Recordset");
rsNews.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/obrien.mdb")
rsNews.Source = "SELECT * FROM tbNews ORDER BY newsDate DESC";
rsNews.CursorType = 0;
rsNews.CursorLocation = 2;
rsNews.LockType = 1;
rsNews.Open();

the page is in the root folder, and the database is in a folder called database, so i'm sure the path is right. i'm getting the 'Arguments are of the wrong type' error. this is the first time ive created a dsnless connection and it sdriving me crazy!
many thanks
- D

dickbaker

9:45 pm on Apr 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For whatever reason I was never able to get Map.Path to work. Here's a dsnless connection string that works for one of my sites:
"PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=D:\database\tmydata.mdb"

If you're using a SQL Server database, the connection string will be different.

Have you tried talking to the support people at your hosting company?

danlott

9:02 am on Apr 19, 2004 (gmt 0)

10+ Year Member



hi dickbaker,
thanks for the reply.
ive entered the code you posted, but getting the error: 'C:\WINDOWS\system32\database\obrien.mdb' is not a valid path.' The site is on my local server under inetpub. i cant find inetpub under the system32 folder (its on the root of the C drive) and i cant seem to change the beginning of the path. I'm also guessing that i would have to ask my hosting company what the path would be to the database as its not a relative path. (my hosting company is not the most forthcoming in technical support).
Why would the Map path not work? Im trying to make this work so i dont have to phone my hosting company becuase that invariably involves being put on hold for 2 hours!
thanks for your help, ive already missed the deadline on this.
- D

danlott

9:47 am on Apr 19, 2004 (gmt 0)

10+ Year Member



hah dickbaker, ive cracked it!
the stupidest thing (they normally are), instead of putting:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/obrien.mdb")

i changed the '&' into '+'. i guess vbscript uses the '&' symbol. Anyway, thats why it wasnt working. thanks for the feedback.
- D

danlott

10:04 am on Apr 19, 2004 (gmt 0)

10+ Year Member



hi dickbaker,
ok, its all working well, but when i try to add a reord to the database (vi an update form), i get the error:
Cannot update. Database or object is read-only.

i know this is beacuse the database folder needs to have write permissions, but the read-only check box (when i right-click on teh folder)is greyed out, and when i go to the security settings, the account has got full control, but the error still occurs. any ideas?
- D

dickbaker

9:54 pm on Apr 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Danlot, it really sounds like you need to talk to your hosting company about the write permission. It may show that you've checked it on your control panel, but it doesn't sound like the server is set up to give you write permission.

I'm no expert on this, but learned something by banging my head against the wall for a long time.

Perhaps someone else who knows more may post here with a better suggestion. Believe me, though, I do know what you're going through.

dickbaker

9:56 pm on Apr 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



P.S. The two-hour wait for support is why I switched to the company I'm with right now. I wanted full tech support and did some shopping around until I found an outfit that responds quickly.

danlott

8:15 am on Apr 20, 2004 (gmt 0)

10+ Year Member



hi dickbaker,
thanks for the suggestion. the problem is on my local machine, i cant understand this. i might go and do some fiddling in IIS!
cheers
- D

dickbaker

9:40 pm on Apr 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"the problem is on my local machine"

Ooops. Sorry about that. Now I don't know what to say.