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="Core Lab.MySql" %>
<script runat="server">
private void Page_Load(objec t sender, System.EventArg s e)
{
// create a connection
MySqlConnection oMySqlConn = new MySqlConnection ();
oMySqlConn.Conn ectionString = "User ID=myuserid;" +
"Password=mypas sword;" +
"Host=localhost ;" +
"Port=3306; " +
"Database=mydat abase;" +
"Direct=tru e;" +
"Protocol=T CP;" +
"Compress=false ;" +
"Pooling=tr ue;" +
"Min Pool Size=0;" +
"Max Pool Size=100;" +
"Connection Lifetime=0";
//open connection
oMySqlConn.Open ();
// create a data adapter
string querystring = "select * from <database>.<tab le name> where
date='2004-06-01'"
OleDbDataAdapte r da = new OleDbDataAdapte r(querystring,
myConnection);
// create a new dataset
DataSet ds = new DataSet();
// fill dataset
da.Fill(ds, "GuidingErr ");
// Attach DataSet to DataGrid
DataGrid1.DataS ource = ds;
DataGrid1.DataB ind();
oMySqlConn.Clos e();
}
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:DataGrid id="DataGrid1" runat="server"> </asp:DataGrid>
</form>
</body>
</html>