Hi I am using MYSQL and ASP.Net. to build the Data Reader Page.
when i define my connection Key - it gives me this error.Keyword not supported: 'dsn'.
[HTML]MY PAGE Data Reader[/HTML] [HTML]<%@ Page Language="C#" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<script runat="server">
protected void Page_Load(objec t sender, EventArgs e)
{
// create the connection
SqlConnection myConnection = new SqlConnection() ;
try
{
// configure the connection
string strConnectionSt ring = ConfigurationMa nager.Connectio nStrings["SqlConnectionS tring"].ConnectionStri ng;
myConnection.Co nnectionString= strConnectionSt ring;
// create the command
string strCommandText = "SELECT ManufacturerNam e, ManufacturerCou ntry, ManufacturerEma il, ManufacturerWeb site FROM Manufacturer ORDER BY ManufacturerNam e";
SqlCommand myCommand = new SqlCommand(strC ommandText, myConnection);
// open the database connection
myConnection.Op en();
// run query
SqlDataReader myReader = myCommand.Execu teReader();
while (myReader.Read( ))
{
// create the manufacturer object
Manufacturer objManufacturer = new Manufacturer();
objManufacturer .Name = Convert.ToStrin g(myReader["ManufacturerNa me"]);
objManufacturer .Country = Convert.ToStrin g(myReader["ManufacturerCo untry"]);
objManufacturer .Email = Convert.ToStrin g(myReader["ManufacturerEm ail"]);
objManufacturer .Website = Convert.ToStrin g(myReader["ManufacturerWe bsite"]);
// output the manufacturer object details
Label1.Text += objManufacturer .ToString() + "<BR/>";
}
// close the reader
myReader.Close( );
}
finally
{
// close the database connection
myConnection.Cl ose();
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Iteratin g Through a DataReader</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Width="84px" Font-Bold="True" ForeColor="Maro on"></asp:Label></div>
</form>
</body>
</html>[/HTML]
Now in Bolded line 16 above in the code causes the error - so i try to put my original connection String i used to connect to MYSQL
"Dsn=MYSQL ODBC 3.51 Driver;uid=Myus er;pwd=Mypasswo rd";
But it still give the same error that Keyword not supported: 'dsn'.
Please guide me - what to do...
Thanks,
Harsh
(I wont give up)
when i define my connection Key - it gives me this error.Keyword not supported: 'dsn'.
[HTML]MY PAGE Data Reader[/HTML] [HTML]<%@ Page Language="C#" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<script runat="server">
protected void Page_Load(objec t sender, EventArgs e)
{
// create the connection
SqlConnection myConnection = new SqlConnection() ;
try
{
// configure the connection
string strConnectionSt ring = ConfigurationMa nager.Connectio nStrings["SqlConnectionS tring"].ConnectionStri ng;
myConnection.Co nnectionString= strConnectionSt ring;
// create the command
string strCommandText = "SELECT ManufacturerNam e, ManufacturerCou ntry, ManufacturerEma il, ManufacturerWeb site FROM Manufacturer ORDER BY ManufacturerNam e";
SqlCommand myCommand = new SqlCommand(strC ommandText, myConnection);
// open the database connection
myConnection.Op en();
// run query
SqlDataReader myReader = myCommand.Execu teReader();
while (myReader.Read( ))
{
// create the manufacturer object
Manufacturer objManufacturer = new Manufacturer();
objManufacturer .Name = Convert.ToStrin g(myReader["ManufacturerNa me"]);
objManufacturer .Country = Convert.ToStrin g(myReader["ManufacturerCo untry"]);
objManufacturer .Email = Convert.ToStrin g(myReader["ManufacturerEm ail"]);
objManufacturer .Website = Convert.ToStrin g(myReader["ManufacturerWe bsite"]);
// output the manufacturer object details
Label1.Text += objManufacturer .ToString() + "<BR/>";
}
// close the reader
myReader.Close( );
}
finally
{
// close the database connection
myConnection.Cl ose();
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Iteratin g Through a DataReader</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Width="84px" Font-Bold="True" ForeColor="Maro on"></asp:Label></div>
</form>
</body>
</html>[/HTML]
Now in Bolded line 16 above in the code causes the error - so i try to put my original connection String i used to connect to MYSQL
"Dsn=MYSQL ODBC 3.51 Driver;uid=Myus er;pwd=Mypasswo rd";
But it still give the same error that Keyword not supported: 'dsn'.
Please guide me - what to do...
Thanks,
Harsh
(I wont give up)