E
Erik H.
Trying to connect to MySQL db on localhost, and populate datagrid from a
dataset using code inline method.
Getting the following compile error:
Error Message: "CS0246: The type or namespace name 'CoreLab' could not be
found (are you missing a using directive or an assembly reference?)"
I downloaded the add on for connecting to MySQL using ADO.NET and installed
it, but am still getting this error. Anybody ever run into this before?
My Code:
<%@ Page Language="C#" %>
<%@ import namespace="CoreLab.MySql" %>
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
// create a connection
MySqlConnection oMySqlConn = new MySqlConnection();
oMySqlConn.ConnectionString = "User ID=myuserid;" +
"Password=mypassword;" +
"Host=localhost;" +
"Port=3306;" +
"Database=mydatabase;" +
"Direct=true;" +
"Protocol=TCP;" +
"Compress=false;" +
"Pooling=true;" +
"Min Pool Size=0;" +
"Max Pool Size=100;" +
"Connection Lifetime=0";
//open connection
oMySqlConn.Open();
// create a data adapter
string querystring = "select * from <database>.<table name> where
date='2004-06-01'"
OleDbDataAdapter da = new OleDbDataAdapter(querystring,
myConnection);
// create a new dataset
DataSet ds = new DataSet();
// fill dataset
da.Fill(ds, "GuidingErr");
// Attach DataSet to DataGrid
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
oMySqlConn.Close();
}
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<aspataGrid id="DataGrid1" runat="server"></aspataGrid>
</form>
</body>
</html>
dataset using code inline method.
Getting the following compile error:
Error Message: "CS0246: The type or namespace name 'CoreLab' could not be
found (are you missing a using directive or an assembly reference?)"
I downloaded the add on for connecting to MySQL using ADO.NET and installed
it, but am still getting this error. Anybody ever run into this before?
My Code:
<%@ Page Language="C#" %>
<%@ import namespace="CoreLab.MySql" %>
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
// create a connection
MySqlConnection oMySqlConn = new MySqlConnection();
oMySqlConn.ConnectionString = "User ID=myuserid;" +
"Password=mypassword;" +
"Host=localhost;" +
"Port=3306;" +
"Database=mydatabase;" +
"Direct=true;" +
"Protocol=TCP;" +
"Compress=false;" +
"Pooling=true;" +
"Min Pool Size=0;" +
"Max Pool Size=100;" +
"Connection Lifetime=0";
//open connection
oMySqlConn.Open();
// create a data adapter
string querystring = "select * from <database>.<table name> where
date='2004-06-01'"
OleDbDataAdapter da = new OleDbDataAdapter(querystring,
myConnection);
// create a new dataset
DataSet ds = new DataSet();
// fill dataset
da.Fill(ds, "GuidingErr");
// Attach DataSet to DataGrid
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
oMySqlConn.Close();
}
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<aspataGrid id="DataGrid1" runat="server"></aspataGrid>
</form>
</body>
</html>