Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 18th, 2004, 06:47 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default Object required error ??

Hi,

I am using this query:

strQuery="INSERT INTO Articles, ArtNode (ArtHeadline, ArtBodyText, ArtStartDate, ArtAuthorID, ArtActive, URD) values ('" & _
f_str_headline & "', '" & f_str_articletext & "', '" & f_str_date & "', " & f_str_author & ", " & f_str_active & ", '" & f_str_urd & "'" & ")"

The funny thing is that the query works but it still generated an error in the browser:

-2147217900 , Syntax error in INSERT INTO statement.Syntax error in INSERT INTO statement.424 , Object requiredObject required

Please Help!
Reply With Quote
  #2 (permalink)  
Old June 18th, 2004, 08:35 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

can you paste your code?

Om Prakash
Reply With Quote
  #3 (permalink)  
Old June 18th, 2004, 10:02 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Om,

I've sent you an email.

Ian

Quote:
quote:Originally posted by om_prakash
 can you paste your code?

Om Prakash
Reply With Quote
  #4 (permalink)  
Old June 18th, 2004, 12:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Hman,

INSERT INTO Articles, ArtNode (ArtHeadline, ArtBodyText, ArtStartDate, ArtAuthorID, ArtActive, URD)...

It looks like you are trying to insert into 2 tables with one insert statement.

That is not possible. Check the Insert Statement syntax.

Code:
INSERT TABLENAME (column_1, column_2) VALUES ('Row #1',1)
Hope that helps.
Cheers!

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
  #5 (permalink)  
Old June 19th, 2004, 12:36 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Yes, as pointed out by vijay,

you are trying to insert data in two tables (Articles, ArtNode)

You need to write 2 seperate queries.


Om Prakash
Reply With Quote
  #6 (permalink)  
Old June 21st, 2004, 09:30 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks but I still get an error when just inserting into one table. I also have another SQL query in my ASP page, which seems to give the error:

'424 , Object requiredObject required '


Here is my other query:

strQuery2="SELECT ArticleID FROM Articles WHERE ArtLastModifDate='" & f_str_modifdate2 & "'"


Please help
Reply With Quote
  #7 (permalink)  
Old June 21st, 2004, 09:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

The other query looks okay, but what is the code on line 424?

Cheers!

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
  #8 (permalink)  
Old June 21st, 2004, 09:56 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Vijay,

I don't think it has anything do with the line number as line 424 is the last line in my code which is just </html>

Here is a break down of my query:

strQuery2="SELECT ArticleID FROM Articles WHERE ArtLastModifDate='" & f_str_modifdate2 & "'"

I am selecting the FIELD 'ArticleID' from the TABLE 'Articles' where the FIELD 'ArtLastModifDate' = to FIELD f_str_modifdate2

'f_str_modifdate2' field is a date & time field and the format will look like this in the database itself: 21/06/2004 15:16:32

BTW it is an 'MS Access' database I am using, NOT SQL database.

Any ideas about the error
Reply With Quote
  #9 (permalink)  
Old June 21st, 2004, 10:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

As It says OBJECT REQUIRED, it should be something with the way you are trying to set your RECORDSET. So just explaining on this SQL statement would show no light on this.

Can you paste some lines before and after this SQL statement?

Also when you say you are using MSACCESS, the date values should be used with # around it in the select statement instead of '.

Also in your previous post you say
Quote:
quote:Thanks but I still get an error when just inserting into one table. I also have another SQL query in my ASP page, which seems to give the error:
Is you insert statement on the same page too? What is that error about? Or it could be the use of ' within the column value which you are trying to insert.

Without seeing some code around it is is hard to narrow down to the problem.

Cheers!

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
  #10 (permalink)  
Old June 21st, 2004, 10:24 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the section of code I am using in my ASP page for the query:


headline_str_db = "Provider=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C:\datafiles\db1.MDB;"

dim f_str_modifdate2
f_str_modifdate2=Request.Form("modifdate")

'variable to store the result
dim l_str_articleid

'Variable for Connection and Recordset
dim conDB2
dim rsDB2
'Creating a instance of a ado connection
set conDB2=server.createobject("ADODB.Connection")

'create a instance of a ado recordset
set rsDB2=server.CreateObject("ADODB.RecordSet")

if err.number<>0 then
     ErrorHandler (Err.number)
end if

string strQuery2,strResult2

'Opening database connection
'conDB.Open f_str_db,f_str_user,f_str_password
conDB2.ConnectionString= headline_str_db
conDB2.Open

if err.number<>0 then
   ErrorHandler (Err.number)
end if

strQuery2="SELECT ArticleID FROM Articles WHERE ArtLastModifDate='" & f_str_modifdate2 & "'"


'Executing the query
set rsDB2=conDB2.Execute(strQuery2)

'testing for end of file
if not rsDB2.EOF then
    strResult2=rsDB2(0).Value

    if err.number<>0 then
       ErrorHandler (Err.number)
    end if

    'Replacing ' with \'
    strResult2=Replace(strResult2,"'","\'")
    if err.number<>0 then
       ErrorHandler (Err.number)
    end if

    'Replacing \n with blank space
    strResult2=Replace(strResult2,chr(10)," ")
    strResult2=Replace(strResult2,chr(13)," ")
    if err.number<>0 then
       ErrorHandler (Err.number)
    end if


    'Assigning into the variable
    l_str_articleid=strResult2

    if err.number<>0 then
       ErrorHandler (Err.number)
    end if

    'displaying the content on the screen
    'Response.Write(l_str_content)

else
    'Response.Write "<script language=javascript>alert('Not found!');</script>"
End if

Sub ErrorHandler(Eno)
  Select case Eno
          case 0
          case Else
                Response.Write(Err.number &" , " & Err.Description)
                l_str_articleid=Err.Description
                Response.Write(l_str_articleid)
                Err.Clear
  End select
  End Sub


conDB2.Close
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Required Error JeffGirard Access 5 October 2nd, 2009 08:09 AM
Object Required error voyeur Javascript 9 January 25th, 2008 11:50 AM
Compile Error: Object required DeannaF829 Beginning VB 6 1 April 24th, 2007 07:12 AM
MSXML Object Required Error??? kevorkian Classic ASP Basics 1 January 5th, 2007 12:43 PM
error....Object required: '' sassenach Classic ASP Databases 2 August 4th, 2003 03:27 PM



All times are GMT -4. The time now is 11:36 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.