Hello,
Im trying to connect to a MySQL DB on my home network (testing purposes) using the following VB.NET code; -
-
Imports System.Data.OleDb
-
-
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
-
-
Dim SQLConnection As OleDbConnection
-
Dim SQLInsertCMD As OleDbCommand
-
Dim sConnString As String = _
-
"Provider=OleMySql.MySqlSource.1;" & _
-
"Data Source=192.168.1.121, 3306;" & _
-
"Initial Catalog=airproductsipdb;" & _
-
"User Id=USERNAME;" & _
-
"Password=PASSWORD"
-
-
SQLConnection = New OleDb.OleDbConnection(sConnString)
-
SQLConnection.Open()
-
-
SQLInsertCMD = New OleDb.OleDbCommand("DROP TABLE table ;")
-
-
End Sub
-
When i execute the code i dont get any error messages from VS such as [2003]: Can't connect to MySQL server on '192.168.1.122 3306' (10060) Say if the IP address is different (.122 instead of .121) I have set up MySQL to allow Remote connections on port 3306 for the username and password (above). I have installed MySQL P which actually does allow me to to get a connection to the DB as it brings back the tables in the DB.
see attached image
However through VS i am unable to display the table data. i get the following error message... -
SQL Execution Error
-
Executed SQl statement: SELECT site_id, Gateway_IP, Sitename, SubentAddress, SubnetMask, BroadcastAddress FROM sitename
-
Error Source: System.Data
-
Error Message: MySQL OLE DB Provider has not been activated
-
Im confused as to whether i have a working connection or not. So ive included a DROP TABLE command to parse to the DB. However the table in question doesnt get dropped. Ive also tried INSERT statements etc but none of which have worked.
So i am unsure whether it is the Connection or SQL Command code that is wrong.
I am using WAMP Server 2.0 with Apache 1.3.39 and MySQL 5.0.45.
If any one has some ideas please help!!!
Thanks in advance
Sy
16 7165
Try the connectionstring below instead of the one you have...I'm really not sure you've got the format right...
Driver={MySQL ODBC 3.51 Driver};Server=[SERVER ADDRESS];Port=[PORT NUMBER];Database=[DATABASE NAME];User=[USERNAME]; Password=[PASSWORD];Option=3;
Put a breakpoint right on the connect call, then when your application breaks out use F8 to step line by line. When you've stepped past the connect call hold your mouse over the connection object and you should see your connectionstring if it connected. If it didn't connect, you'll see it says "Nothing".
Try the connectionstring below instead of the one you have...I'm really not sure you've got the format right...
Driver={MySQL ODBC 3.51 Driver};Server=[SERVER ADDRESS];Port=[PORT NUMBER];Database=[DATABASE NAME];User=[USERNAME]; Password=[PASSWORD];Option=3;
Put a breakpoint right on the connect call, then when your application breaks out use F8 to step line by line. When you've stepped past the connect call hold your mouse over the connection object and you should see your connectionstring if it connected. If it didn't connect, you'll see it says "Nothing".
Hi balabaster,
thanks for getting back to me.
Ive tried your Connection string replacing mine. I inserted the breakpoint as you said and unfortunatley i get the "nothing"response when holding my mouse over the connection object.... -
ConnectionString = "Driver={MySQL ODBC 3.51 Driver};Server=192.168.1.121;Port=3306;Database=airproductsipdb;User=USERNAME;Password=PASSWORD;Option=3;"
-
-
ConnectionTimeout = 15
-
Container = Nothing
-
DataSource = ""
-
Driver = ""
-
ServerVersion = {"Invalid operation. The connection is closed."}
-
Site = Nothing
-
State = Closed{0}
-
So i checked and notcied i didnt have the ODBC driver installed. I have downloaded and installed Driver 3.51.23 also setting it up in Data Sources ODBC. Now i get the following...... -
-
ConnectionString = "Driver={MySQL ODBC 3.51 Driver};Datasource=wampmysqld;Server=192.168.1.121;Port=3306;Database=airproductsipdb;User=USERNAME;Password=PASSWORD;Option=3;"
-
-
ConnectionTimeout = 15
-
Container = Nothing
-
Database = "airproductsipdb"
-
DataSource = "192.168.1.121 via TCP/IP"
-
Driver = "myodbc3.dll"
-
ServerVersion = "5.0.45-community-nt"
-
Site = Nothing
-
State = Open{1}
-
-
Now from what you've said, does this show i have an established connection? Sorry im rather new to VB.NET , maybe getting ahead of myself.
Also if i do does that mean my ODBC Command syntax of DROP TABLE table is incorrect? -
-
Dim SQLInsertCMD As Odbc.OdbcCommand
-
SQLInsertCMD = New Odbc.OdbcCommand("DROP TABLE table ;")
-
-
Thanks
Sy
Hi balabaster,
thanks for getting back to me.
Ive tried your Connection string replacing mine. I inserted the breakpoint as you said and unfortunatley i get the "nothing"response when holding my mouse over the connection object.... -
ConnectionString = "Driver={MySQL ODBC 3.51 Driver};Server=192.168.1.121;Port=3306;Database=airproductsipdb;User=USERNAME;Password=PASSWORD;Option=3;"
-
-
ConnectionTimeout = 15
-
Container = Nothing
-
DataSource = ""
-
Driver = ""
-
ServerVersion = {"Invalid operation. The connection is closed."}
-
Site = Nothing
-
State = Closed{0}
-
So i checked and notcied i didnt have the ODBC driver installed. I have downloaded and installed Driver 3.51.23 also setting it up in Data Sources ODBC. Now i get the following...... -
-
ConnectionString = "Driver={MySQL ODBC 3.51 Driver};Datasource=wampmysqld;Server=192.168.1.121;Port=3306;Database=airproductsipdb;User=USERNAME;Password=PASSWORD;Option=3;"
-
-
ConnectionTimeout = 15
-
Container = Nothing
-
Database = "airproductsipdb"
-
DataSource = "192.168.1.121 via TCP/IP"
-
Driver = "myodbc3.dll"
-
ServerVersion = "5.0.45-community-nt"
-
Site = Nothing
-
State = Open{1}
-
-
Now from what you've said, does this show i have an established connection? Sorry im rather new to VB.NET , maybe getting ahead of myself.
Also if i do does that mean my ODBC Command syntax of DROP TABLE table is incorrect? -
-
Dim SQLInsertCMD As Odbc.OdbcCommand
-
SQLInsertCMD = New Odbc.OdbcCommand("DROP TABLE table ;")
-
-
Thanks
Sy
The fact that the State property is now set to open is promising... can you provide the line of code where you instantiate the connection object?
If you are connecting using the OleDbConnection object, then the reason your drop command isn't working is because you're using the OdbcCommand where you should be using the OledbCommand (in the Oledb namespace)
The fact that the State property is now set to open is promising... can you provide the line of code where you instantiate the connection object?
If you are connecting using the OleDbConnection object, then the reason your drop command isn't working is because you're using the OdbcCommand where you should be using the OledbCommand (in the Oledb namespace)
Hey,
Ok ive changed the odbc command to OleDB Command. I dont totally understand what you mean by the line of code for 'instantiating' the connection object (:$)...sorry..(ill get 'Newb' tattooed across my forehead!) The code below is all ive been working with ... -
-
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
-
-
Dim SQLConnection As Odbc.OdbcConnection
-
-
Dim SQLInsertCMD As OleDb.OleDbCommand
-
-
Dim sConnString As String = _
-
"Driver={MySQL ODBC 3.51 Driver};" & _
-
"Datasource=wampmysqld;" & _
-
"Server=192.168.1.121;" & _
-
"Port=3306;" & _
-
"Database=airproductsipdb;" & _
-
"User=USERNAME;" & _
-
"Password=PASSWORD;" & _
-
"Option=3;"
-
-
SQLConnection = New Odbc.OdbcConnection(sConnString)
-
SQLConnection.Open()
-
-
SQLInsertCMD = New OleDb.OleDbCommand("DROP TABLE table ;")
-
End Sub
-
-
Ive attached some screen shots also of the MySQL Connector ODBC configuration. ...if that helps.
Sy
Hey,
Ok ive changed the odbc command to OleDB Command. I dont totally understand what you mean by the line of code for 'instantiating' the connection object (:$)...sorry..(ill get 'Newb' tattooed across my forehead!) The code below is all ive been working with ... -
-
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
-
-
Dim SQLConnection As Odbc.OdbcConnection
-
-
Dim SQLInsertCMD As OleDb.OleDbCommand
-
-
Dim sConnString As String = _
-
"Driver={MySQL ODBC 3.51 Driver};" & _
-
"Datasource=wampmysqld;" & _
-
"Server=192.168.1.121;" & _
-
"Port=3306;" & _
-
"Database=airproductsipdb;" & _
-
"User=USERNAME;" & _
-
"Password=PASSWORD;" & _
-
"Option=3;"
-
-
SQLConnection = New Odbc.OdbcConnection(sConnString)
-
SQLConnection.Open()
-
-
SQLInsertCMD = New OleDb.OleDbCommand("DROP TABLE table ;")
-
End Sub
-
-
Ive attached some screen shots also of the MySQL Connector ODBC configuration. ...if that helps.
Sy
Okay, I'm understanding your code a little better now... the line of code - SQLConnection = New Odbc.OdbcConnection(sConnString)
is where you're instantiating the connection - "instantiate: create an instance of". I notice now that you're actually using the OdbcConnection object to connect, so you were actually right in using the OdbcCommand to execute the command. I personally prefer the Oledb namespace to the Odbc one - however, each has their advantages and disadvantages and really in many cases, it comes down to personal preference and/or availability of drivers. What is critical though is that whichever you use for your connection object, you must use the same type for your command object and consequently parameters etc.
There is one issue with your code that will prevent your drop command running and that is that you're not actually executing it. I would probably use code similar to the following: - Dim sConString As String = _
-
"Driver={MySQL ODBC 3.51 Driver};" & _
-
"Datasource=wampmysqld;" & _
-
"Server=192.168.1.121;" & _
-
"Port=3306;" & _
-
"Database=airproductsipdb;" & _
-
"User=USERNAME;" & _
-
"Password=PASSWORD;" & _
-
"Option=3;"
-
-
Dim oCon As Oledb.OleDbConnection = New Oledb.OledbConnection(sConnString)
-
Try
-
oCon.Open()
-
Dim oCmd As Oledb.OledbCommand = New OleDb.OleDbCommand("DROP TABLE table;")
-
-
'This is the crucial line that you're missing
-
oCmd.ExecuteNonQuery() 'This will execute a query that doesn't require a response
-
''If you require a response then you would use the commented out code block below:
-
'Dim oRdr As Oledb.OledbDataReader = oCmd.ExecuteReader()
-
'If oRdr.HasRows Then
-
' While oRdr.Read
-
' Dim sOut As String = oRdr("Field1")
-
'' etc...
-
' End While
-
'End If
-
Catch ex As Exception
-
MsgBox ex.Message
-
Finally
-
oCmd.Dispose()
-
oCon.Close()
-
oCon.Dispose()
-
End Try
Okay, I'm understanding your code a little better now... the line of code - SQLConnection = New Odbc.OdbcConnection(sConnString)
is where you're instantiating the connection - "instantiate: create an instance of". I notice now that you're actually using the OdbcConnection object to connect, so you were actually right in using the OdbcCommand to execute the command. I personally prefer the Oledb namespace to the Odbc one - however, each has their advantages and disadvantages and really in many cases, it comes down to personal preference and/or availability of drivers. What is critical though is that whichever you use for your connection object, you must use the same type for your command object and consequently parameters etc.
There is one issue with your code that will prevent your drop command running and that is that you're not actually executing it. I would probably use code similar to the following: - Dim sConString As String = _
-
"Driver={MySQL ODBC 3.51 Driver};" & _
-
"Datasource=wampmysqld;" & _
-
"Server=192.168.1.121;" & _
-
"Port=3306;" & _
-
"Database=airproductsipdb;" & _
-
"User=USERNAME;" & _
-
"Password=PASSWORD;" & _
-
"Option=3;"
-
-
Dim oCon As Oledb.OleDbConnection = New Oledb.OledbConnection(sConnString)
-
Try
-
oCon.Open()
-
Dim oCmd As Oledb.OledbCommand = New OleDb.OleDbCommand("DROP TABLE table;")
-
-
'This is the crucial line that you're missing
-
oCmd.ExecuteNonQuery() 'This will execute a query that doesn't require a response
-
''If you require a response then you would use the commented out code block below:
-
'Dim oRdr As Oledb.OledbDataReader = oCmd.ExecuteReader()
-
'If oRdr.HasRows Then
-
' While oRdr.Read
-
' Dim sOut As String = oRdr("Field1")
-
'' etc...
-
' End While
-
'End If
-
Catch ex As Exception
-
MsgBox ex.Message
-
Finally
-
oCmd.Dispose()
-
oCon.Close()
-
oCon.Dispose()
-
End Try
Hey balabaster
Thanks for you help today. Helpfull to have the commented sections, makes learning a lot easier. Since looking at your code a few developements. I see you've used the OleDB method so ive adapted my connection string work with this -
-
Dim sConnString As String = _
-
"Provider=OleMySql.MySqlSource.1;" & _
-
"Datasource=wampmysqld;" & _
-
"Server=192.168.1.121;" & _
-
"Port=3306;" & _
-
"Database=airproductsipdb;" & _
-
"User=USERNAME;" & _
-
"Password=PASSWORD;" & _
-
"Option=3;"
-
When Running the codei get the following error...
'DB Remote Connection to WAMP'
"Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."
this occurs with the following code.. -
-
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
-
-
Dim SQLConnection As OleDb.OleDbConnection
-
-
'Dim SQLInsertCMD As OleDb.OleDbCommand
-
-
Dim sConnString As String = _
-
"Provider=OleMySql.MySqlSource.1;" & _
-
"Datasource=wampmysqld;" & _
-
"Server=192.168.1.121;" & _
-
"Port=3306;" & _
-
"Database=airproductsipdb;" & _
-
"User=USERNAME;" & _
-
"Password=PASSWORD;" & _
-
"Option=3;"
-
-
SQLConnection = New OleDb.OleDbConnection(sConnString)
-
-
Dim oCon As OleDb.OleDbConnection = New OleDb.OleDbConnection(sConnString)
-
Try
-
oCon.Open()
-
Dim oCmd As OleDb.OleDbCommand = New OleDb.OleDbCommand("DROP TABLE table;")
-
-
'This is the crucial line that you're missing
-
oCmd.ExecuteNonQuery() 'This will execute a query that doesn't require a response
-
''If you require a response then you would use the commented out code block below:
-
'Dim oRdr As Oledb.OledbDataReader = oCmd.ExecuteReader()
-
'If oRdr.HasRows Then
-
' While oRdr.Read
-
' Dim sOut As String = oRdr("Field1")
-
'' etc...
-
' End While
-
'End If
-
Catch ex As Exception
-
MsgBox(ex.Message)
-
Finally
-
'oCmd.Dispose()
-
oCon.Close()
-
oCon.Dispose()
-
End Try
-
End Sub
-
So i also tried your code with the ODBC method code as follows... -
-
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
-
-
Dim SQLConnection As Odbc.OdbcConnection
-
-
'Dim SQLInsertCMD As OleDb.OleDbCommand
-
-
Dim sConnString As String = _
-
"Driver={MySQL ODBC 3.51 Driver};" & _
-
"Datasource=wampmysqld;" & _
-
"Server=192.168.1.121;" & _
-
"Port=3306;" & _
-
"Database=airproductsipdb;" & _
-
"User=USERNAME;" & _
-
"Password=PASSWORD;" & _
-
"Option=3;"
-
-
SQLConnection = New Odbc.OdbcConnection(sConnString)
-
-
Dim oCon As Odbc.OdbcConnection = New Odbc.OdbcConnection(sConnString)
-
Try
-
oCon.Open()
-
Dim oCmd As Odbc.OdbcCommand = New Odbc.OdbcCommand("DROP TABLE table;")
-
-
'This is the crucial line that you're missing
-
oCmd.ExecuteNonQuery() 'This will execute a query that doesn't require a response
-
''If you require a response then you would use the commented out code block below:
-
'Dim oRdr As Oledb.OledbDataReader = oCmd.ExecuteReader()
-
'If oRdr.HasRows Then
-
' While oRdr.Read
-
' Dim sOut As String = oRdr("Field1")
-
'' etc...
-
' End While
-
'End If
-
Catch ex As Exception
-
MsgBox(ex.Message)
-
Finally
-
'oCmd.Dispose()
-
oCon.Close()
-
oCon.Dispose()
-
End Try
-
End Sub
-
Whilst running this i get the error message 'ExecuteNonQuery: Connection property has not been initialized'
Thanks again,
Sy
After your oCon.Open() line, add the line MsgBox(oCon.State.ToString) this should tell you if the connection to the database was actually opened successfully or not.
Add the line:
MsgBox(oCon.State.ToString) after the line oCon.Open. This will tell you if the connection is actually opened successfully or not. I think it's likely to do with your connection to your MySQL Server, unfortunately, I'm not a MySQL expert so I may not be able to help much there I'm afraid.
Add the line:
MsgBox(oCon.State.ToString) after the line oCon.Open. This will tell you if the connection is actually opened successfully or not. I think it's likely to do with your connection to your MySQL Server, unfortunately, I'm not a MySQL expert so I may not be able to help much there I'm afraid.
Hey balabaster,
Thanks for all your help so far....life saver!
I added the MsgBox, and i get an "Open" response then followed by the other catch exception message box stating....'ExecuteNonQuery: Connection Property has not been initialised.'
Could it be an issue with the ODBC setup on my developement environment? The screen shots i attached on a previous post show what ive configured. Noticing that in odBC Data Source Administrator i have under 'User DSN' my server connection name 'wampmysqld' with the ODBC driver 3.51 AND the same has been configured in the 'System DSN'
Any more helpful thoughts oh wise balabaster?
Thanks
Sy
Hey balabaster,
Thanks for all your help so far....life saver!
I added the MsgBox, and i get an "Open" response then followed by the other catch exception message box stating....'ExecuteNonQuery: Connection Property has not been initialised.'
Could it be an issue with the ODBC setup on my developement environment? The screen shots i attached on a previous post show what ive configured. Noticing that in odBC Data Source Administrator i have under 'User DSN' my server connection name 'wampmysqld' with the ODBC driver 3.51 AND the same has been configured in the 'System DSN'
Any more helpful thoughts oh wise balabaster?
Thanks
Sy
I notice that you've configured all the necessary options to render the DataSource=WAMP-whatever-it-was completely redundant.
Maybe try dropping that option from your connectionstring. The standard .NET connectionstring to access a MySql database (at least according the http://www.connectionstrings.com/) is the following:
"Driver={MySQL ODBC 3.51 Driver};Server=data.domain.com;Port=3306;Database= myDataBase;User=myUsername; Password=myPassword;Option=3;"
Notice that no ODBC DSN name is provided in that string, yet (presumably) still works. Also, I'd verify that the name of the driver is correct "MySQL ODBC 3.51 Driver" - verify that in your ODBC manager, you may actually be using a different driver and consequently need to change this. The string you require is the same as the name of the driver you choose in the ODBC manager.
In my experience though, when you're using a DSN, you only need to specify something akin to:
"DataSource=MyDSN;User=MyUsername;Password=MyPassw ord;"
Any relevant DSN options for that driver where the defaults are required to be overridden would be appended to the end of that string with a semi-colon delimiter. If you specified all the required options when you configured the DSN, then your connectionstring could be as simple as:
"DataSource=MyDSN;"
Of course, think about security when you do things like this...obviously not having to specify a username and password when accessing a database is somewhat frivolous in most cases.
I notice that you've configured all the necessary options to render the DataSource=WAMP-whatever-it-was completely redundant.
Maybe try dropping that option from your connectionstring. The standard .NET connectionstring to access a MySql database (at least according the http://www.connectionstrings.com/) is the following:
"Driver={MySQL ODBC 3.51 Driver};Server=data.domain.com;Port=3306;Database= myDataBase;User=myUsername; Password=myPassword;Option=3;"
Notice that no ODBC DSN name is provided in that string, yet (presumably) still works. Also, I'd verify that the name of the driver is correct "MySQL ODBC 3.51 Driver" - verify that in your ODBC manager, you may actually be using a different driver and consequently need to change this. The string you require is the same as the name of the driver you choose in the ODBC manager.
In my experience though, when you're using a DSN, you only need to specify something akin to:
"DataSource=MyDSN;User=MyUsername;Password=MyPassw ord;"
Any relevant DSN options for that driver where the defaults are required to be overridden would be appended to the end of that string with a semi-colon delimiter. If you specified all the required options when you configured the DSN, then your connectionstring could be as simple as:
"DataSource=MyDSN;"
Of course, think about security when you do things like this...obviously not having to specify a username and password when accessing a database is somewhat frivolous in most cases.
Hey balabaster,
Ok looking at the driver name it is "3.51.23" however changing the Driver string to Driver={MySQL ODBC 3.51.23 Driver} i get the error message "ERROR [IM002][Mircrosoft][ODBC Driver Manager] Data source name not fond and no default driver specified" So it would seem the driver 3.51 is the correct string to use?
Looking at connectionstrings.com and your suggestion that it should work even though the DSN isnt called seems to be the case. Removing the "Datasource=wampmysqld;" from the connection string to resolves to the same error messages as before; ExecuteNonQuery: Connecion property has not been initialized ...sigh....
In ODBC DSN, should the File DSN be configured?
Thanks for you continued help with this.
Sy
Hey balabaster,
Ok looking at the driver name it is "3.51.23" however changing the Driver string to Driver={MySQL ODBC 3.51.23 Driver} i get the error message"ERROR [IM002][Mircrosoft][ODBC Driver Manager] Data source name not fond and no default driver specified" So it would seem the driver 3.51 is the correct string to use?
Looking at connectionstrings.com and your suggestion that it should work even though the DSN isnt called seems to be the case. Removing the "Datasource=wampmysqld;" from the connection string to resolves to the same error messages as before;ExecuteNonQuery: Connecion property has not been initialized ...sigh....
In ODBC DSN, should the File DSN be configured?
Thanks for you continued help with this.
Sy
If you reference using "DSN=MyDSN" then you would need a DSN configured - it doesn't matter whether it's file, user or system. Obviously a user DSN is only visible to the user that created it, so if it needs to be system wide it would have to be either file or system. I favour system, but if you favour file, that's okay too. If you're referencing using the longer connectionstring (without the DSN specified) then you don't even need to configure an ODBC entry in the ODBC Configuration Manager.
In answer to the problem at hand though - You've not referenced the connection object in your command initialization. - Dim oCmd As New OdbcCommand("Drop Table MyTable;", oCon)
Notice in yours, that you only have - Dim oCmd As New OdbcCommand("Drop Table MyTable;")
Sorry, I should've picked that up earlier... but at least you've probably got a better understanding of ODBC while tracking through this...
If you reference using "DSN=MyDSN" then you would need a DSN configured - it doesn't matter whether it's file, user or system. Obviously a user DSN is only visible to the user that created it, so if it needs to be system wide it would have to be either file or system. I favour system, but if you favour file, that's okay too. If you're referencing using the longer connectionstring (without the DSN specified) then you don't even need to configure an ODBC entry in the ODBC Configuration Manager.
In answer to the problem at hand though - You've not referenced the connection object in your command initialization. - Dim oCmd As New OdbcCommand("Drop Table MyTable;", oCon)
Notice in yours, that you only have - Dim oCmd As New OdbcCommand("Drop Table MyTable;")
Sorry, I should've picked that up earlier... but at least you've probably got a better understanding of ODBC while tracking through this...
Hey balabaster,
Dont apologise! Its funny really. Whilst having no luck with the ODBC method i moved back to OLeDB and managed to get it to work!!!! Amazing what happens when you spend hours and hours researching the internet AND more importantly getting help from people such as yourself! -
-
Dim SQLConnection As OleDbConnection
-
Dim SQLInsertCMD As OleDbCommand
-
-
Dim sConnString As String = _
-
"Provider=OleMySql.MySqlSource.1;" & _
-
"Data Source= " + TextBox1.Text + ";" & _
-
"Initial Catalog=airproductsipdb;" & _
-
"User Id=USERNAME;" & _
-
"Password=PASSWORD;"
-
-
SQLConnection = New OleDb.OleDbConnection(sConnString)
-
-
SQLConnection.Open()
-
-
'SQLInsertCMD = New OleDb.OleDbCommand("DROP TABLE siteaddresses ;")
-
SQLInsertCMD = SQLConnection.CreateCommand()
-
SQLInsertCMD.CommandText = "DROP TABLE test1 ;"
-
SQLInsertCMD.ExecuteNonQuery()
-
MsgBox("Query executed")
-
-
By including the command within the connection i got it to work.
But! Thanks to your last post i now can get the ODBC to work! The missing 'oCon' from the Odbc.OdbcCommand string resolved the issue. It would seem in both cases the resolution was the same :D
So a BIG thank you to you Balabastar!
However now i face another problem.................Which to choose! :P lol
Thanks again...i will be back to bug the community once more with further problems :P
Sy
Glad to help. Good luck with the other issues.
P.S. Now that you've broadcasted your database username/password to the world, you should change it ;o)
I made an attempt to edit all the posts (All that QUOTEing killed me, hehe) and remove the username and password. If I missed any let me know.
You should still change them though.
I made an attempt to edit all the posts (All that QUOTEing killed me, hehe) and remove the username and password. If I missed any let me know.
You should still change them though.
Thanks Plater....very foolish of me indeed! Although the permissions set up for that username account are only granted to my local IP address etc. Still a change would be sensible.
Cheers guys,
Sy
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Nashat Wanly |
last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and
Visual C# .NET
View products that this article applies to.
This article was previously published under Q310070
For a Microsoft...
|
by: Lilly |
last post by:
Hi all.
I'm really sorry for this post, I'm sure most of you will think it's a
silly question, but the following doesn't work and I'm really new to
ASP.NET:
<%@ Page Language="C#" %>
<%@...
|
by: Nathan Sokalski |
last post by:
I am trying to connect to a Microsoft Access Database from my ASP.NET
Application. I use the following code to create my connection string:
cmdSelect.Connection = New...
|
by: Terry |
last post by:
I am getting the following message back from ASP.NET. MDAC 2.8 is installed
as is .NET Framework 1.1 with SP and security updates on a Win 2K Server.
For some reason .NET is not recognizing that...
|
by: petro |
last post by:
Hello all,
My asp.net web application works on my machine but I get the following error
on our test web server, There is only one oracle home on the test server.
Does anyone know how to resolve...
|
by: BookerW |
last post by:
I am not sure which forum I should post this on, but here is the problem. I
have a front end web application(VB) on asp,net 1.1 framework. Inside of the
code, I have the following lines to...
|
by: sck10 |
last post by:
Hello,
I am using the following in ASP.NET 2.0 VB using ADODB (which is working).
I would like to convert this to csharp using ADO.NET.
To build the connection, I am trying to convert:
...
|
by: YEW |
last post by:
Hi, all
I am new to ASP.NET. I am testing an example that inserts a record into an access database. But i have got an error when i browse the sample aspx page from IE 7.
In the error the line...
|
by: bw171 |
last post by:
Hopefully, I frame this problem/question correctly.
I have some code written/updated in visual studio 2003. This code when setup on other machines where I have installed the Oracle 9i client, and...
|
by: =?Utf-8?B?Ym9va2VyQG1ndA==?= |
last post by:
Hopefully, I frame this problem/question correctly.
I have some code written/updated in visual studio 2003. This code when
setup on other machines where I have installed the Oracle 9i client,...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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,...
| |