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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving Data to a Local Text File (part 2)

Status
Not open for further replies.

stein555

Programmer
Apr 18, 2003
24
US
Ok...I have started working on this again...I am using FSO to write to a text file from a web page...the share that I am writing to is set to grant full access to "Everyone".

But I still receive an error when I attempt to open the text file for writing/reading...

Here is the code...

Set textDB = Server.CreateObject("Scripting.FileSystemObject")
Set rsText = textDB.OpenTextFile("\\ServerName\Public\Inventory\Inventory.txt",2,TRUE)
rsText.WriteLine("This is a test...")
rsText.Close

It errors out on the second line (where it opens the file) and returns

error '80070041'

Thats it - no more text other than what line it errored out on...anyone have any ideas what I am doing wrong?

Thanks...
 
Add :

I have also tried going through a different connection (as described on one of the FAQ's here...

set textDB = Server.CreateObject("ADODB.Connection")
textDB.Open "DRIVER={Microsoft Text Driver (*.txt; *.csv)};DefaultDir=\\ServerName\public\inventory\inventory.txt"

This gives me the error:

[Microsoft][ODBC Text Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x2e0 Thread 0xb98 DBC 0x2b61024 Text'.

I think that means that it can't access the file (the page doesn't have the rights)...so now I'm stumped...
 
I may be on to something here...I changed the path to the web server and used a different user ID when connecting and the error went away...

Now I can't figure out how to write data to it - I tried using INSERT and UPDATE but it tells me I there is a syntax error...

I am only guessing, but is this the way to do that?

str = "INSERT INTO Inventory.txt Text=This is a Test..."
textDB.Execute(strSQL)

It isn't working for me and I am currently trying to find some information on inserting information into a text file...
 
I just realized I got the UPDATE and INSERT functions mixed up for syntax /bonk me...

Now I have :

strSQL = "INSERT INTO Inventory.txt Values('This is a TEST!')"

This gives me the error :

[Microsoft][ODBC Text Driver] Operation must use an updateable query.

Off to the races again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top