Connect mysql via oledb

Joined
Sep 1, 2008
Messages
1
Reaction score
0
Hello ,

I want to connect my asp.net /c# with the mysql database.
But it doesn`t work. :-(

my web.config:

<configuration>
<appSettings>
<add key="MM_CONNECTION_STRING" value="Provider= MSDataShape.1;Driver= {MySQL ODBC 3.51 Driver};Server= localhost;Database= xxxx;User Id= xxxx ;Password= xxxx;" />
</appSettings>
</configuration>



my file:

<%@ Page Language="C#" Debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Data.OleDb" %>



<script runat="server" >
protected void Button1_Click(Object sender, EventArgs e) {

string connStr = ConfigurationManager.AppSettings["MM_CONNECTION_STRING"].ToString();

OleDbConnection MyConnection = new OleDbConnection(connStr);
SqlDataAdapter MySqlCommand = new SqlDataAdapter ("INSERT INTO xxxx (WerbeID, Werbearten) VALUES (1, Drinnen)", MyConnection);




}

</script>



The Output is:
CS1502: The best overloaded method match for 'System.Data.SqlClient.SqlDataAdapter.SqlDataAdapt er(string, string)' has some invalid arguments
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top