[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Changing from ODBC connections to MySQL connector/NET

Posted on 2011-03-15
6
Medium Priority
?
498 Views
Last Modified: 2012-05-11
Question: Currently I use the following items for db connections, but I have had to change to MySQL Connector/Net and of course i need the new versions of the following:

This is how I normally make the declarations:

Dim objConn As New OdbcConnection(ConfigurationSettings.AppSettings("DSN"))
Dim objCmd As OdbcCommand
Dim objRdr As OdbcDataReader
Dim objDA As OdbcDataAdapter
Dim objDS As New DataSet()

Are the new versions:

Dim objConn As New SqlConnection(ConfigurationSettings.AppSettings("DSN2"))  'defined in web.config
Dim objRdr As SqlDataReader
Dim objCmd As SqlCommand
Dim objDA As SqlDataReader

are these correct?

If I add parameters is it still

objCmd.Parameters.Add("test",strTest)

Thanks
0
Comment
Question by:j-w-thomas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
6 Comments
 
LVL 5

Accepted Solution

by:
mayankagarwal earned 400 total points
ID: 35145917
yes it is correct.

If you are getting any error while using this code then please mention the same

Mayank
0
 
LVL 3

Assisted Solution

by:j-w-thomas
j-w-thomas earned 0 total points
ID: 35146837
Thanks and how about a NonQuery ? Is it still:

objRdr = objCmd.ExecuteReader()
0
 
LVL 3

Author Comment

by:j-w-thomas
ID: 35146868
I do not think that i have the connection string correct in my web.config. I am getting this error:

Message A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 3

Author Comment

by:j-w-thomas
ID: 35146876
This is my web.config. It works fine with ODBC

<appSettings>
            <add key="DSN2" value="Server=localhost;Database=mydb;UID=root;Password=123;" />
</appSettings>
0
 
LVL 3

Author Comment

by:j-w-thomas
ID: 35146913
This is to connect to a MySQL db just to confirm as well
0
 
LVL 3

Author Closing Comment

by:j-w-thomas
ID: 35187295
no follow up from expert after first entry, but I still needed help
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question