473,507 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Newbie problem with database connection

1 New Member
Hi!

I am starting out with ASP and have tried the following code, to no avail as I get a error:

[HTML]ADODB.Recordset.1 (0x800A0E7D)
Invalid connection.
/save.asp, line 12[/HTML]

Expand|Select|Wrap|Line Numbers
  1. <%
  2. uuid = Request("uuid")
  3. msgid = Request("msgid")
  4.  
  5. Dim objConn
  6. Dim objRS
  7. Set objRS = Server.CreateObject("ADODB.Recordset")
  8. Set objConn = Server.CreateObject("ADODB.Connection")
  9.  
  10. objConn.ConnectionString="DRIVER={MySQL};SERVER=localhost;"_
  11. &"DATABASE=xxxxxx;UID=xxxxxx;PWD=xxxxxx;"
  12. objRS.Open "SMS", objConn
  13.  
  14. objRS.addnew
  15. objRS("uuid") = uuid
  16. objRS("msgid") = msgid
  17. objRS.update
  18.  
  19. objRS.Close
  20. Set objRS = Nothing
  21. objConn.Close
  22. Set objConn = Nothing
  23. %>
I tried to read the database with the same connection string, and that worked. I created a table called "SMS" with two fields, "uuid" and "msgid". Any ideas?
Dec 21 '06 #1
3 2060
sashi
1,754 Recognized Expert Top Contributor
Hi!

I am starting out with ASP and have tried the following code, to no avail as I get a error:

[HTML]ADODB.Recordset.1 (0x800A0E7D)
Invalid connection.
/save.asp, line 12[/HTML]

Expand|Select|Wrap|Line Numbers
  1. <%
  2. uuid = Request("uuid")
  3. msgid = Request("msgid")
  4.  
  5. Dim objConn
  6. Dim objRS
  7. Set objRS = Server.CreateObject("ADODB.Recordset")
  8. Set objConn = Server.CreateObject("ADODB.Connection")
  9.  
  10. objConn.ConnectionString="DRIVER={MySQL};SERVER=localhost;"_
  11. &"DATABASE=xxxxxx;UID=xxxxxx;PWD=xxxxxx;"
  12. objRS.Open "SMS", objConn
  13.  
  14. objRS.addnew
  15. objRS("uuid") = uuid
  16. objRS("msgid") = msgid
  17. objRS.update
  18.  
  19. objRS.Close
  20. Set objRS = Nothing
  21. objConn.Close
  22. Set objConn = Nothing
  23. %>
I tried to read the database with the same connection string, and that worked. I created a table called "SMS" with two fields, "uuid" and "msgid". Any ideas?
Hi there,

Kindly refer to below modified code segment, hope it helps. Good luck & Take care.

Expand|Select|Wrap|Line Numbers
  1.   objConn.ConnectionString=("Driver={MySQL ODBC 3.51 Driver};Server=localhost;"
  2.  "Database=MyDatabase;User=MyUserName;Password=MyPassword;Option=4;");
  3.   objRS.Open "SMS", objConn, 3, 1
  4.  
Dec 22 '06 #2
karthi84
271 Contributor
can u tell me whether i am correct about ur post. r u adding a new user info into your sql table named sms through that page.

if i am correct reply and get me a note to my personal message so that i can find u have replied.
Dec 29 '06 #3
sashi
1,754 Recognized Expert Top Contributor
can u tell me whether i am correct about ur post. r u adding a new user info into your sql table named sms through that page.

if i am correct reply and get me a note to my personal message so that i can find u have replied.
Hi there,

The problem here is not about trying to insert new data to whatever table, it's INVALID CONNECTION !. Please refer to the problem statement (the first message in this thread). Look at the error message, this error is because the user did not use the correct MySQL driver to get connected to the database. Hope you understand the situation clearly now!
Dec 30 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1531
by: mcena | last post by:
This is the code I wish to have explained what each line stands for. Am using VB6 and MYSQL, Win XP. Private Sub Class_Initialize() On Error GoTo errlabel Dim db As Connection Set db = New...
5
3316
by: yoyoz | last post by:
Help!!!! i am newbie to php, i was trying to establish the connection to another machine (solaris) so that i can retrieve data from the database stored inside there using my own PC. for your...
3
2119
by: Tom McQ | last post by:
Would somebody please have a look at the following piece of code for me? It is supposed to write a single record to one table in a database and a group of related records to another table. It worked...
5
2020
oll3i
by: oll3i | last post by:
my librarybean package library.ejb; import java.sql.*; import javax.ejb.*; import library.common.*; @Stateless @Remote
0
936
by: Rauf Sarwar | last post by:
Originally posted by dreimer You have to use ODBC/ADO etc to connect to the database. I don't know the exact syntax but you can search in comp.lang.visual.basic NG. Another suggestion.... dump...
3
1669
by: db_happy | last post by:
Hello I install Oracle8 Enterprise Edition Release 8.0.4 for Windows NT and I choose Typical in Starter Database.As I understand ORACLE create a sample database for me (If that is wrong please...
4
977
by: MooVBuff | last post by:
I am new to VB.2005 and to make it worse, I'm switching over from VB 6.0. I have figured out how to programmatically Create a Database and Table and how to add data to an Access database (Two weeks...
6
1892
by: raylopez99 | last post by:
Will ASP.NET 3.0 work under Visual Studio 2005? And what is a good newbie ASP.NET book? Subject: Will ASP.NET 3.0 work under Visual Studio 2005? And what is a good newbie ASP.NET book? My...
5
1161
by: Gilles Ganault | last post by:
Hello I'd like to know what the right way is to access an item in a row as returned by a database: ===== import apsw connection=apsw.Connection("test.sqlite") cursor=connection.cursor()
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7114
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1544
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.