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

HELP with insert new records to DB

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
<%
dim query, con
Set Con = Server.CreateObject( &quot;ADODB.Connection&quot; )
Con.Open( &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; _& Server.MapPath( &quot;database/Krapp.mdb&quot; ) )
set filesy = createobject(&quot;scripting.filesystemobject&quot;)
set txtfile = filesy.Opentextfile(&quot;I:/webalizer/&quot; & name _& &quot;/webalizer.hist&quot;,1, 0)

Do
line = txtfile.Readline
query = &quot;INSERT INTO Dateandusagestatistics_(Month,Year,pagesviewed,Filesviewed,Sitesfrom,Data,_
Unknown1,Unknown2,Hits,Uniquevisits)&quot; & &quot; Values_
(&quot; & replace(line,&quot; &quot;,&quot;,&quot;) & &quot;)&quot;
con.execute(query)

if viewresults=&quot;y&quot; then %>
<% Responce.write %><% =query %><br>
<% end if %>

<% '--------------------------DISPLAY RESULTS------------ %>

<% 'if viewresults=&quot;y&quot; or viewresults=&quot;Y&quot; then %>
<% '=line %>
<BR>
<% 'end if %>

<% '----------------END DISPLAY RESULTS------------------ %>

<% line=&quot;&quot; %>
<%
Loop until txtfile.atEndofstream
txtfile.close

con.close
set con = nothing
%>

__________________________________________________________

the above code takes the file record (the actual record is below)

8 2001 7322 0 96 16866 11 31 7322 632

and translates each number into a variable and value, placing them into the database table Dateandusagestatistics.

or at least its supposed to

whenever i run the script the following error appears

******************************************

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

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

/test.asp, line 81

******************************************

any help would be appreciated

thanks
 
So, try this code...
The vold code is modified
Code:
<% 
dim query, con
Set Con = Server.CreateObject( &quot;ADODB.Connection&quot; )
[b]Con.Open &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot;& Server.MapPath(&quot;database/Krapp.mdb&quot;)[/b]
set filesy = createobject(&quot;scripting.filesystemobject&quot;)
set txtfile = filesy.Opentextfile(&quot;I:/webalizer/&quot; & name _& &quot;/webalizer.hist&quot;,1, 0)
    
Do
line = txtfile.Readline
[b]query = &quot;INSERT INTO Dateandusagestatistics(Month,Year,pagesviewed,Filesviewed,Sitesfrom,Data,
Unknown1,Unknown2,Hits,Uniquevisits) Values (&quot;&replace(line,&quot; &quot;,&quot;,&quot;,1,-1,1)& &quot;)&quot;
con.execute query[/b]
            
if viewresults=&quot;y&quot; then %>
<% Responce.write %><% =query %><br>
<% end if %>         
<BR>
<% line=&quot;&quot; %>
<%
Loop until txtfile.atEndofstream
txtfile.close           
con.close
set con = nothing
%>
________
George, M
 
thankyou for your help, but this is also generating the same error message

any other suggestions., thanks
 
Dateandusagestatistics is probalbly a Query not a table.

some types of Query, for example a crosstabQuery do not allow data to be updated.

To check this (if it is a query) open up the query in access, and try to change a field.

If you cant, then that's yer issue...
 
Probably not the solution to your erro but:
<% Responce.write %><% =query %><br>
should be
<% Response.write %>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top