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
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