Solved

Changing from ODBC connections to MySQL connector/NET

Posted on 2011-03-15
6
494 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 100 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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
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

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
reverse engineer .sql from php files 11 65
Problem with MySQL query - graph 3 44
php hashing methods 3 48
Code not executing correctly. 3 43
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

737 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