467,174 Members | 1,294 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,174 developers. It's quick & easy.

ASP AND MYSQL ERROR : "Keyword not supported: 'dsn'."

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="System.Data.SqlClient" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
// create the connection
SqlConnection myConnection = new SqlConnection();

try
{
// configure the connection
string strConnectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
myConnection.ConnectionString= strConnectionString;

// create the command
string strCommandText = "SELECT ManufacturerName, ManufacturerCountry, ManufacturerEmail, ManufacturerWebsite FROM Manufacturer ORDER BY ManufacturerName";
SqlCommand myCommand = new SqlCommand(strCommandText, myConnection);

// open the database connection
myConnection.Open();

// run query
SqlDataReader myReader = myCommand.ExecuteReader();

while (myReader.Read())
{
// create the manufacturer object
Manufacturer objManufacturer = new Manufacturer();
objManufacturer.Name = Convert.ToString(myReader["ManufacturerName"]);
objManufacturer.Country = Convert.ToString(myReader["ManufacturerCountry"]);
objManufacturer.Email = Convert.ToString(myReader["ManufacturerEmail"]);
objManufacturer.Website = Convert.ToString(myReader["ManufacturerWebsite"]);

// output the manufacturer object details
Label1.Text += objManufacturer.ToString() + "<BR/>";
}

// close the reader
myReader.Close();
}
finally
{
// close the database connection
myConnection.Close();
}
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Iterating Through a DataReader</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Width="84px" Font-Bold="True" ForeColor="Maroon"></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=Myuser;pwd=Mypassword";

But it still give the same error that Keyword not supported: 'dsn'.


Please guide me - what to do...

Thanks,
Harsh
(I wont give up)
Jul 9 '07 #1
  • viewed: 1901
Share:

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Willem van Rumpt | last post: by
3 posts views Thread by filip.norrgard@gmail.com | last post: by
matthardwick
reply views Thread by matthardwick | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.