473,626 Members | 3,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MySQL & Datagrid using C# - getting compile error

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>
Nov 18 '05 #1
6 3181
Hello,

Try to add this row at the beginning of your code:

<%@ Register TagPrefix="cr" Namespace="Core Lab.MySql"
Assembly="CoreL ab.MySql, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= 09af7300eec2370 1" %>
Nov 18 '05 #2
I had to make some other changes to my code to get this to work, so I'm
posting my new code in case anybody else needs this info in the future and
comes across this thread.

Thanks again for your help Vladimir!

My Code:

<%@ Page Language="C#" Debug="true" %>
<%@ Register TagPrefix="cr" Namespace="Core Lab.MySql"
Assembly="CoreL ab.MySql, Version=2.40.1. 0, Culture=neutral ,
PublicKeyToken= 09af7300eec2370 1" %>
<%@ import Namespace="Core Lab.MySql" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>

<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=<user id>;" +
"Password=<pass word>;" +
"Host=localhost ;" +
"Database=< db name>;" +
"Direct=tru e;" +
"Protocol=T CP;" +
"Compress=false ;";
string querystring = "select fields from table";

MySqlCommand mySqlCommand = new
CoreLab.MySql.M ySqlCommand(que rystring);

MySqlDataAdapte r da = new CoreLab.MySql.M ySqlDataAdapter ();

DataSet ds = new DataSet();

mySqlCommand.Co nnection = oMySqlConn;

da.SelectComman d = mySqlCommand;

oMySqlConn.Open ();
// fill dataset
da.Fill(ds, "Results");

// 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">
<HeaderStyle font-bold="True" forecolor="Whit e"
backcolor="Gray "></HeaderStyle>
<AlternatingIte mStyle
backcolor="Ligh tGray"></AlternatingItem Style>
</asp:DataGrid>
</form>
</body>
</html>

"Vladimir Zheleznyak" <ik**@crlab.com > wrote in message
news:34******** *************** ***@posting.goo gle.com...
Hello,

Try to add this row at the beginning of your code:

<%@ Register TagPrefix="cr" Namespace="Core Lab.MySql"
Assembly="CoreL ab.MySql, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= 09af7300eec2370 1" %>

Nov 18 '05 #3
Note that the version value in my Register directive differs from Vladimir's
example. Be sure that you check your version information and put the right
value in there or the compiler won't like it.

-Erik
"Erik H." <er*********@ww ireless.com> wrote in message
news:#D******** ******@TK2MSFTN GP11.phx.gbl...
I had to make some other changes to my code to get this to work, so I'm
posting my new code in case anybody else needs this info in the future and
comes across this thread.

Thanks again for your help Vladimir!

My Code:

<%@ Page Language="C#" Debug="true" %>
<%@ Register TagPrefix="cr" Namespace="Core Lab.MySql"
Assembly="CoreL ab.MySql, Version=2.40.1. 0, Culture=neutral ,
PublicKeyToken= 09af7300eec2370 1" %>
<%@ import Namespace="Core Lab.MySql" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>

<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=<user id>;" +
"Password=<pass word>;" +
"Host=localhost ;" +
"Database=< db name>;" +
"Direct=tru e;" +
"Protocol=T CP;" +
"Compress=false ;";
string querystring = "select fields from table";

MySqlCommand mySqlCommand = new
CoreLab.MySql.M ySqlCommand(que rystring);

MySqlDataAdapte r da = new CoreLab.MySql.M ySqlDataAdapter ();

DataSet ds = new DataSet();

mySqlCommand.Co nnection = oMySqlConn;

da.SelectComman d = mySqlCommand;

oMySqlConn.Open ();
// fill dataset
da.Fill(ds, "Results");

// 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">
<HeaderStyle font-bold="True" forecolor="Whit e"
backcolor="Gray "></HeaderStyle>
<AlternatingIte mStyle
backcolor="Ligh tGray"></AlternatingItem Style>
</asp:DataGrid>
</form>
</body>
</html>

"Vladimir Zheleznyak" <ik**@crlab.com > wrote in message
news:34******** *************** ***@posting.goo gle.com...
Hello,

Try to add this row at the beginning of your code:

<%@ Register TagPrefix="cr" Namespace="Core Lab.MySql"
Assembly="CoreL ab.MySql, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= 09af7300eec2370 1" %>


Nov 18 '05 #4
I had to make some other changes to my code to get this to work, so I'm
posting my new code in case anybody else needs this info in the future and
comes across this thread.

Thanks again for your help Vladimir!

My Code:

<%@ Page Language="C#" Debug="true" %>
<%@ Register TagPrefix="cr" Namespace="Core Lab.MySql"
Assembly="CoreL ab.MySql, Version=2.40.1. 0, Culture=neutral ,
PublicKeyToken= 09af7300eec2370 1" %>
<%@ import Namespace="Core Lab.MySql" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>

<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=<user id>;" +
"Password=<pass word>;" +
"Host=localhost ;" +
"Database=< db name>;" +
"Direct=tru e;" +
"Protocol=T CP;" +
"Compress=false ;";
string querystring = "select fields from table";

MySqlCommand mySqlCommand = new
CoreLab.MySql.M ySqlCommand(que rystring);

MySqlDataAdapte r da = new CoreLab.MySql.M ySqlDataAdapter ();

DataSet ds = new DataSet();

mySqlCommand.Co nnection = oMySqlConn;

da.SelectComman d = mySqlCommand;

oMySqlConn.Open ();
// fill dataset
da.Fill(ds, "Results");

// 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">
<HeaderStyle font-bold="True" forecolor="Whit e"
backcolor="Gray "></HeaderStyle>
<AlternatingIte mStyle
backcolor="Ligh tGray"></AlternatingItem Style>
</asp:DataGrid>
</form>
</body>
</html>

"Vladimir Zheleznyak" <ik**@crlab.com > wrote in message
news:34******** *************** ***@posting.goo gle.com...
Hello,

Try to add this row at the beginning of your code:

<%@ Register TagPrefix="cr" Namespace="Core Lab.MySql"
Assembly="CoreL ab.MySql, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= 09af7300eec2370 1" %>

Nov 18 '05 #5
Note that the version value in my Register directive differs from Vladimir's
example. Be sure that you check your version information and put the right
value in there or the compiler won't like it.

-Erik
"Erik H." <er*********@ww ireless.com> wrote in message
news:#D******** ******@TK2MSFTN GP11.phx.gbl...
I had to make some other changes to my code to get this to work, so I'm
posting my new code in case anybody else needs this info in the future and
comes across this thread.

Thanks again for your help Vladimir!

My Code:

<%@ Page Language="C#" Debug="true" %>
<%@ Register TagPrefix="cr" Namespace="Core Lab.MySql"
Assembly="CoreL ab.MySql, Version=2.40.1. 0, Culture=neutral ,
PublicKeyToken= 09af7300eec2370 1" %>
<%@ import Namespace="Core Lab.MySql" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>

<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=<user id>;" +
"Password=<pass word>;" +
"Host=localhost ;" +
"Database=< db name>;" +
"Direct=tru e;" +
"Protocol=T CP;" +
"Compress=false ;";
string querystring = "select fields from table";

MySqlCommand mySqlCommand = new
CoreLab.MySql.M ySqlCommand(que rystring);

MySqlDataAdapte r da = new CoreLab.MySql.M ySqlDataAdapter ();

DataSet ds = new DataSet();

mySqlCommand.Co nnection = oMySqlConn;

da.SelectComman d = mySqlCommand;

oMySqlConn.Open ();
// fill dataset
da.Fill(ds, "Results");

// 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">
<HeaderStyle font-bold="True" forecolor="Whit e"
backcolor="Gray "></HeaderStyle>
<AlternatingIte mStyle
backcolor="Ligh tGray"></AlternatingItem Style>
</asp:DataGrid>
</form>
</body>
</html>

"Vladimir Zheleznyak" <ik**@crlab.com > wrote in message
news:34******** *************** ***@posting.goo gle.com...
Hello,

Try to add this row at the beginning of your code:

<%@ Register TagPrefix="cr" Namespace="Core Lab.MySql"
Assembly="CoreL ab.MySql, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= 09af7300eec2370 1" %>


Nov 18 '05 #6
I am having a similar problem. My code works fine for VB.net but gives
the error - "namespace name corelab not found" in C# code. I tried
using your code - added this at top of the page-

<%@ Register TagPrefix="cr" Namespace="Core Lab.MySql"
<BR>Assembly="C oreLab.MySql, Version=2.70.1. 0, Culture=neutral ,

<BR>PublicKeyTo ken=09af7300eec 23701" %>

with correct version no. Still when I use using CoreLab.MySql; in my
.cs page, it throws error. Any idea?

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
5263
by: Bill Eldridge | last post by:
I'm trying to grab a document off the Web and toss it into a MySQL database, but I keep running into the various encoding problems with Unicode (that aren't a problem for me with GB2312, BIG 5, etc.) What I'd like is something as simple as: CREATE TABLE junk (junklet VARCHAR(2500) CHARACTER SET UTF8)); import MySQLdb, re,urllib
0
6677
by: Donald Tyler | last post by:
Then the only way you can do it that I can think of is to write a PHP script to do basically what PHPMyAdmin is trying to do but without the LOCAL in there. However to do that you would need to be able to place the PHP file on the server, and I guess you probably can't do that either. Talk about catch 22... The only other way I can think of is to install MySQL on a machine you control, then import the data there using the method I...
0
3939
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest version of this document can be found at: http://prdownloads.sourceforge.net/souptonuts/README_mysql.txt?download
2
269
by: ME | last post by:
I am getting: "ERROR SQLBindParameter not used for all parameters" when attempting to run the following code: Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.UpdateCommand
0
1105
by: George R. Kasica | last post by:
Hello: Trying to upgrade from MySQL 3.23.40 to 4.1.16 and am having no luck getting the sources compiled. If you need further information or output please ask, I would be happy to provide it, but don't wish to clog up the ng with unneeded info. I run the configure as follows (as shown in the INSTALL-SOURCES doc:
1
2436
by: gordon.dtr | last post by:
Hi, Has anyone had this problem ? I am using MySQL ODBC 3.51 Driver, with MS Access 2003 and MySQL 4.1.11 standard log. I created my tables in MS Access, then exported them via ODBC to an externally hosted MySQL database (fasthosts) . I then import-linked
2
3165
by: Norm | last post by:
I'm fairly new to this so please bear with me. I installed MySQL on my local machine and created a database and table. I created a User DSN and a System DSN and they tested ok. Here's my .net code: <%@ Page Language="VB" Debug="false" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.Odbc" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
1
4348
George Lft
by: George Lft | last post by:
ok, first of all, i built my register page using dreamweaver tool which the codes haven been out of control. Now i'm thinking that turning over everything - by using this another set of codes. And these new sets of codes have overwhelmed me a bit. Here's the new code: CREATE TABLE `users` ( `ID` int(11) NOT NULL auto_increment, `Username` varchar(255) NOT NULL, `Password` varchar(255) NOT NULL, `Temp_pass` varchar(55)...
2
2166
by: ree321 | last post by:
I tried moving an ASP.net project form 1.1 to 2.0. But I am having problems with getting the OnItemDataBound function to run for a datagrid, in 2.0. It only gets called up if AutoGenerateColumns is set to false. Is there anyway around this? Then I tried changing the datagrid to GridView and still I am having trouble getting the function to run in code behind using: Sub databoundGeneral(ByVal s As Object, ByVal e As
0
8262
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7192
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5571
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1507
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.