Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Error when running SQL on ASP Page

Author  Topic 

ajwposh
Starting Member

1 Post

Posted - 2009-11-02 : 06:25:11
[code]
"INSERT INTO an_test1 (First_Name, Surname, DOB, Address1, Address2, Address3, Town, County, PostCode, Telephone, Email, [Password]) VALUES ('"&fname&"','"&sname&"','"&dob&"','"&add1&"','"&add2&"','"&add3&"','"&twn&"','"&cnt&"','"&pc&"','"&tel&"','"&ema&"','"&pas&"') SELECT '"&username&"' = [user] FROM an_test1 INSERT INTO an_test ([Username], [Password]) VALUES ('"&username&"','"&pas&"')"
[/code]
I get the error
Cannot use empty object or column names. Use a single space if necessary.

The SQL works for the first insert, however when i add the code to select username as user and insert into an_test I get this error.

The sql works when called from a stored procedure but not when the sql is embedded in the asp.

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-11-03 : 11:37:23
problem might be with password

'"&pas&"' where is the value of password being set? and '"&pas&"' seems to be an empty object so error is correct

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -