|
 |
asp_databases thread: SQL issue.. problems problems problems
Message #1 by "Brad Libby" <libby_brad@b...> on Thu, 14 Sep 2000 01:10:42 +0100
|
|
I am having a problem entering data into a SQL table. This problems occurs
whether i use recordset or the "insert" command. And it occurs on the
line where i execute the statement..
Here is the senerio
I grab the data to be entered from a cookie (i choose to use cookies becuz
someone told me that session were the devil hehehehehhhe)
here is the code
set my_conn = server.createobject("adodb.connection")
connection = "Provider=MS Remote; Remote Server=sqldata.abac.com; Remote
Provider=SQLOLEDB; database=mydatabase;UID=myusername;PWD=mypassword;"
StrSQl = "insert into users (username, password, first, last, address,
city, state, country, gender, income, zip, age, fax, company, telephone,
icq, email) values ('" & username & "', '" & password & "', '" & fname &
"', '" & lname & "', '" & address & "', '" & city & "', '" & state & "',
'" & country & "', '" & gender & "', '" & income & "', '" & zip & "', '" &
age & "', '" & fax & "', '" & company & "', '" & telephone & "', '" & icq
& "', '" & email & "')"
my_conn.Execute StrSql '''error occurs here'''
my_conn.close
set my_conn = nothing
I recieve the following error
Microsoft ADO/RDS error '800a1004'
Business object cannot be created.
/register/thanks.asp, line 42
I have verifyed that the table name is valid and that all the columns are
valid.. when i connect via ODBC i dont get any error and the data goes
right in.. But once again someone told me that ODBC is the devil
hehehehe...
Thanks
Brad
PS this obdc connstring works
connection = "DRIVER={SQL
Server};SERVER=SQLDATA;LANGUAGE=us_english;DATABASE=mydatabas;UID=myusername;PWD=mypass"
Message #2 by "Holloway, Mike" <HollowayM@E...> on Thu, 14 Sep 2000 07:54:39 -0500
|
|
I'll give it a shot. You have not tied my_conn to your connection string,
connection.
Essentially it looks like you do not have an open connection at the time you
are trying
to execute the SQL. In short you must open the connection before you try to
use it.
-----Original Message-----
From: Brad Libby [mailto:libby_brad@b...]
Sent: Wednesday, September 13, 2000 7:11 PM
To: ASP Databases
Subject: [asp_databases] SQL issue.. problems problems problems
I am having a problem entering data into a SQL table. This problems occurs
whether i use recordset or the "insert" command. And it occurs on the
line where i execute the statement..
Here is the senerio
I grab the data to be entered from a cookie (i choose to use cookies becuz
someone told me that session were the devil hehehehehhhe)
here is the code
set my_conn = server.createobject("adodb.connection")
connection = "Provider=MS Remote; Remote Server=sqldata.abac.com; Remote
Provider=SQLOLEDB; database=mydatabase;UID=myusername;PWD=mypassword;"
StrSQl = "insert into users (username, password, first, last, address,
city, state, country, gender, income, zip, age, fax, company, telephone,
icq, email) values ('" & username & "', '" & password & "', '" & fname &
"', '" & lname & "', '" & address & "', '" & city & "', '" & state & "',
'" & country & "', '" & gender & "', '" & income & "', '" & zip & "', '" &
age & "', '" & fax & "', '" & company & "', '" & telephone & "', '" & icq
& "', '" & email & "')"
my_conn.Execute StrSql '''error occurs here'''
my_conn.close
set my_conn = nothing
I recieve the following error
Microsoft ADO/RDS error '800a1004'
Business object cannot be created.
/register/thanks.asp, line 42
I have verifyed that the table name is valid and that all the columns are
valid.. when i connect via ODBC i dont get any error and the data goes
right in.. But once again someone told me that ODBC is the devil
hehehehe...
Thanks
Brad
PS this obdc connstring works
connection = "DRIVER={SQL
Server};SERVER=SQLDATA;LANGUAGE=us_english;DATABASE=mydatabas;UID=myusername
;PWD=mypass"
Message #3 by "Ray Murphy" <raymondmurphy@c...> on Thu, 14 Sep 2000 14:55:56 +0100
|
|
Brad,
May be worth a try - your connection string that fails has a closing ";"
after PWD, as in :
set my_conn = server.createobject("adodb.connection")
connection = "Provider=MS Remote; Remote Server=sqldata.abac.com; Remote
Provider=SQLOLEDB; database=mydatabase;UID=myusername;PWD=mypassword;"
but your odbc connection, which works, doesn't have the closing ";".
So it may be worth amending your connection string accordingly.
HTH.
Ray
|
|
 |