|
 |
aspx_beginners thread: Ch2 datacontrol.aspx example (ASP.NET & C#)
Message #1 by "Blue Tiger" <bluetiger@m...> on Mon, 9 Dec 2002 05:04:22 -0500
|
|
Hello,
Help? I am using the Beginning ASP.NET with C# book...
In Chapter2, the datacontrol.aspx code had me type this up, but I keep
getting errors, such as:
Compiler Error Message: CS0246: The type or namespace name
'OleDbConnection'
could not be found (are you missing a using directive or an assembly
reference?) starting with line that begins with "1OleDbConnection
objConnection;". What am I missing?
The code:
<% Import Namespace=3D"System.Data" %>
<% Import Namespace=3D"System.Data.OleDb" %>
<script language=3D"C#" runat=3D"server">
void Page_Load (object sender, EventArgs e)
{
OleDbConnection objConnection;
OleDbDataAdapter objCommand;
string strConnect;
string strCommand;
DataSet DataSet1 =3D new DataSet();
strConnect =3D @"Provider=3DMicrosoft.Jet.OLEDB.4.0";
strConnect +=3D @"Data Source=3DC:\Program
Files\Microsoft.NET\FrameworkSDK\";
strConnect +=3D
@"Samples\quickstart\aspplus\samples\grocertogo\data";
strConnect +=3D @"\grocertogo.mdb;";
strConnect +=3D "Persist Security Info=3DFalse";
strCommand =3D "SELECT ProductName, UnitPrice FROM products";
objConnection =3D new OleDbDataAdapter (strCommand, objConnection);
objCommand.Fill(DataSet1, "products");
DataGrid1.DataSource=3DDataSet1.Tables["Products"].DefaultView;
DataGrid1.DataBind();
}
Message #2 by "Hovik Melkomian" <melvik@b...> on Mon, 9 Dec 2002 14:19:37 +0330
|
|
I've used ACCESS * OLEDB_Connection just for one time.
but I got it wont work if u set by visual setting.
try to set the connection string urself manually & ensure u have to
use mappath.
HTH,
Hovik.
----- Original Message -----
From: "Blue Tiger" <bluetiger@m...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Monday, December 09, 2002 1:34 PM
Subject: [aspx_beginners] Ch2 datacontrol.aspx example (ASP.NET & C#)
Hello,
Help? I am using the Beginning ASP.NET with C# book...
In Chapter2, the datacontrol.aspx code had me type this up, but I keep
getting errors, such as:
Compiler Error Message: CS0246: The type or namespace name 'OleDbConnection'
could not be found (are you missing a using directive or an assembly
reference?) starting with line that begins with "1OleDbConnection
objConnection;". What am I missing?
The code:
<% Import Namespace="System.Data" %>
<% Import Namespace="System.Data.OleDb" %>
<script language="C#" runat="server">
void Page_Load (object sender, EventArgs e)
{
OleDbConnection objConnection;
OleDbDataAdapter objCommand;
string strConnect;
string strCommand;
DataSet DataSet1 = new DataSet();
strConnect = @"Provider=Microsoft.Jet.OLEDB.4.0";
strConnect += @"Data Source=C:\Program
Files\Microsoft.NET\FrameworkSDK\";
strConnect += @"Samples\quickstart\aspplus\samples\grocertogo\data";
strConnect += @"\grocertogo.mdb;";
strConnect += "Persist Security Info=False";
strCommand = "SELECT ProductName, UnitPrice FROM products";
objConnection = new OleDbDataAdapter (strCommand, objConnection);
objCommand.Fill(DataSet1, "products");
DataGrid1.DataSource=DataSet1.Tables["Products"].DefaultView;
DataGrid1.DataBind();
}
Message #3 by "Blue Tiger" <bluetiger@m...> on Mon, 9 Dec 2002 06:01:00 -0500
|
|
Thanks,
After I typed this email I saw several bits I missed like the @ before
my
import namespaces at the beginning, missed a semicolon too & the
objConnection line wasn't right later in the code.
I compared it line by line to the code from Wrox, used in both VS.NET &
WebMatrix...so all is well now....Thanks again.
-----Original Message-----
From: Hovik Melkomian [mailto:melvik@b...]
Sent: Monday, December 09, 2002 5:50 AM
To: aspx_beginners
Subject: [aspx_beginners] Re: Ch2 datacontrol.aspx example (ASP.NET &
C#)
I've used ACCESS * OLEDB_Connection just for one time.
but I got it wont work if u set by visual setting.
try to set the connection string urself manually & ensure u have to
use mappath.
HTH,
Hovik.
----- Original Message -----
From: "Blue Tiger" <bluetiger@m...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Monday, December 09, 2002 1:34 PM
Subject: [aspx_beginners] Ch2 datacontrol.aspx example (ASP.NET & C#)
Hello,
Help? I am using the Beginning ASP.NET with C# book...
In Chapter2, the datacontrol.aspx code had me type this up, but I keep
getting errors, such as:
Compiler Error Message: CS0246: The type or namespace name
'OleDbConnection'
could not be found (are you missing a using directive or an assembly
reference?) starting with line that begins with "1OleDbConnection
objConnection;". What am I missing?
The code:
<% Import Namespace=3D"System.Data" %>
<% Import Namespace=3D"System.Data.OleDb" %>
<script language=3D"C#" runat=3D"server">
void Page_Load (object sender, EventArgs e)
{
OleDbConnection objConnection;
OleDbDataAdapter objCommand;
string strConnect;
string strCommand;
DataSet DataSet1 =3D new DataSet();
strConnect =3D @"Provider=3DMicrosoft.Jet.OLEDB.4.0";
strConnect +=3D @"Data Source=3DC:\Program
Files\Microsoft.NET\FrameworkSDK\";
strConnect +=3D
@"Samples\quickstart\aspplus\samples\grocertogo\data";
strConnect +=3D @"\grocertogo.mdb;";
strConnect +=3D "Persist Security Info=3DFalse";
strCommand =3D "SELECT ProductName, UnitPrice FROM products";
objConnection =3D new OleDbDataAdapter (strCommand, objConnection);
objCommand.Fill(DataSet1, "products");
DataGrid1.DataSource=3DDataSet1.Tables["Products"].DefaultView;
DataGrid1.DataBind();
}
Message #4 by "Mazen Alzogbi" <lists@a...> on Mon, 9 Dec 2002 14:15:47 +0400
|
|
Are you referencing the System.Data namespace in your VS.NET project
under References?
Mazen Alzogbi [AspElite]
Editor and .NET Developer
ArabASP.NET - The #1 Arabic ASP.NET Community Site
www.arabasp.net
-----Original Message-----
From: Blue Tiger [mailto:bluetiger@m...]
Sent: Monday, December 09, 2002 2:04 PM
To: aspx_beginners
Subject: [aspx_beginners] Ch2 datacontrol.aspx example (ASP.NET & C#)
Hello,
Help? I am using the Beginning ASP.NET with C# book...
In Chapter2, the datacontrol.aspx code had me type this up, but I keep
getting errors, such as:
Compiler Error Message: CS0246: The type or namespace name
'OleDbConnection'
could not be found (are you missing a using directive or an assembly
reference?) starting with line that begins with "1OleDbConnection
objConnection;". What am I missing?
The code:
<% Import Namespace="System.Data" %>
<% Import Namespace="System.Data.OleDb" %>
<script language="C#" runat="server">
void Page_Load (object sender, EventArgs e)
{
OleDbConnection objConnection;
OleDbDataAdapter objCommand;
string strConnect;
string strCommand;
DataSet DataSet1 = new DataSet();
strConnect = @"Provider=Microsoft.Jet.OLEDB.4.0";
strConnect += @"Data Source=C:\Program
Files\Microsoft.NET\FrameworkSDK\";
strConnect += @"Samples\quickstart\aspplus\samples\grocertogo\data";
strConnect += @"\grocertogo.mdb;";
strConnect += "Persist Security Info=False";
strCommand = "SELECT ProductName, UnitPrice FROM products";
objConnection = new OleDbDataAdapter (strCommand, objConnection);
objCommand.Fill(DataSet1, "products");
DataGrid1.DataSource=DataSet1.Tables["Products"].DefaultView;
DataGrid1.DataBind();
}
|
|
 |