Current location: Hot Scripts Forums » Programming Languages » ASP » error about "insert into"


error about "insert into"

Reply
  #1 (permalink)  
Old 06-08-04, 09:51 AM
oztecnic oztecnic is offline
New Member
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
error about "insert into"

hi ı am triying to add a new record to ms access db but ı get an error about wrong insert into my code is here...


<%@ language=Vbscript %>
<% Option Explicit %>
<% Response.Buffer=False %>
<!--#include file="scripts/inc/dbconnect.asp"-->
<%
Dim ObjRecord

Set objRecord=Server.CreateObject("ADODB.Recordset" )
objRecord.Open "Counter" , objConnect,,3,2

Dim StrDate,Counter,Pager
StrDate=CStr(FormatDateTime(date, 1))

Do While not objRecord.Eof
If StrDate = objRecord("Date" ) Then
Dim Found
Found=True
Else
objRecord.Movenext
End If
Loop

If Found=True Then
Counter=CInt(objRecord("Counter" ))
Pager=CInt(objRecord("Pager" ))

If not Session("counted" ) Then
Counter=Counter + 1 'eğer counted adında bir Session yoksa countera bir ekleniyor
End If

Pager=Pager + 1 'pager a her durumda mutlaka 1 eklenecek
objRecord("Counter" )=CStr(Counter)
objRecord("Pager" )=CStr(Pager)
objRecord.Update
objRecord.Movefirst
Else
Counter=1
Pager=1
objRecord.AddNew <--error is here...
objRecord("Date" )=StrDate
objRecord("Counter" )=CStr(Counter)
objRecord("Pager" )=CStr(Pager)
objRecord.Update <--error is here...
objRecord.Movefirst
End If


Dim TotalCounter, TotalPager
TotalCounter=0
TotalPager=0
While not objRecord.Eof
If Strdate=objRecord("Date" ) Then

TotalCounter=TotalCounter + CInt(objRecord.Fields("Counter" ).Value)
TotalPager=TotalPager + CInt(objRecord.Fields("Pager" ).Value)
ObjRecord.Movenext

End If
Wend

objRecord("TotalCounter" )=CStr(TotalCounter)
objRecord("TotalPager" )=CStr(TotalPager)
objRecord.Update
objRecord.Close
Set objRecord=Nothing



%>
<!--#include file="scripts/inc/dbclose.asp"-->
<%
Response.Write "Bu counter " &Counter&"<BR>"
Response.Write "Bu Pager " &Pager&"<BR>"
Response.Write "Bu tottal Counter " & TotalCounter&"<BR>"
Response.Write "Bu total Pager " &TotalPager
%>

give me a tip
Reply With Quote
  #2 (permalink)  
Old 06-09-04, 01:19 AM
chirag's Avatar
chirag chirag is offline
Newbie Coder
 
Join Date: May 2004
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,

can you post exact error message that is displayed on your screen...
??
Reply With Quote
  #3 (permalink)  
Old 06-09-04, 02:44 PM
oztecnic oztecnic is offline
New Member
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
/artimyeni/counter.asp, line 43
Reply With Quote
  #4 (permalink)  
Old 06-10-04, 10:13 PM
EvilHaider EvilHaider is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Where is your actual insert statement? I see the line you referenced where the error occurs is objrecord.Addnew

I am not familiar with this syntax. if objecrecord is of type recordset, adding something to that recordset does not run an insert statement on your database. The recordset is disjointed from your database. Where is your actual SQL insert query?
__________________
**
Tutorial Maniacs
**
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 04:23 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.