473,569 Members | 2,870 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 2068
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
1532
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 Connection db.CursorLocation = adUseClient 'is this line relevant? in which Context? db.Open "PROVIDER=MSDASQL;dsn=KWTSYS;uid=root;pwd=;" ...
5
3321
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 information, i am using apache 1.3.27 as my web server, php4 and mysql as i try to build an database with a web portal. the following is the scripts...
3
2126
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 without any problems when I was using Access 97 and a "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("/d1/d101.mdb") connection...
5
2025
oll3i
by: oll3i | last post by:
my librarybean package library.ejb; import java.sql.*; import javax.ejb.*; import library.common.*; @Stateless @Remote
0
948
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 VB script/ASP and go with Java. Regards /Rauf Sarwar
3
1676
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 inform me).Also the installation create some services.Probably my starter database is OracleServiceORCL and OracleStartORCL which they running.Also...
4
980
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 work). I'm having trouble trying to figure out how to Update and Delete a record (Row) from an existing database. I'm finished with trying to find...
6
1894
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 question is in the title. I have experience with C#, SQL, C++/CLI and have done exercises in a book on database design, so I'm not a total beginner,...
5
1168
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
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6287
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3657
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2117
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 we have to send another system

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.