Scott Billsborough
4/4/2002 7:57:00 PM
Here is some sample code I wrote:
<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Assembly Name="Microsoft.Data.Odbc" %>
<html>
<head>
</head>
<script language="C#" runat=server>
private void SubmitBtn_Click(Object sender, EventArgs e) {
Microsoft.Data.Odbc.OdbcConnection myConnection = new
Microsoft.Data.Odbc.OdbcConnection("DRIVER={MySql};SERVER=localhost;UID=root
;PWD=myPassword;DATABASE=running;");;
String query = "select * from runs";
Microsoft.Data.Odbc.OdbcDataAdapter adapter = new
Microsoft.Data.Odbc.OdbcDataAdapter();
adapter.SelectCommand = new Microsoft.Data.Odbc.OdbcCommand(query,
myConnection);
DataSet dataset = new DataSet();
adapter.Fill(dataset, "runs");
MyList.DataSource = dataset.Tables["runs"].DefaultView;
MyList.DataBind();
}
</script>
<body>
<form action="intro8.aspx" method="post" runat="server">
<asp:button text="Lookup" OnClick="SubmitBtn_Click" runat="server"/>
<ASP:DataGrid id="MyList" HeaderStyle-BackColor="#aaaadd"
BackColor="#ccccff" runat="server"/>
</form>
</body>
</html>
This running is a datbase on MySql but I also got this to work with Acces
and MS SQL 7. P.S. I don't have Visual Studio either. I did have to copy
Microsoft.Data.Odbc.dll to the bin directory in my virtual directory. IE
\devel is a virtual directory point to c:\devel\aspx so I put the dll in
c:\devel\aspx\bin\Microsoft.Data.Odbc.
Scott
"kevin Rourke" <krourke@inmagic.com> wrote in message
news:25bc01c1d60e$4a4e3490$a4e62ecf@tkmsftngxa06...
> I am having a problem using objects in the
> Microsoft.Data.ODBC namespace. The answer to this problem
> seems to be that I need to add a reference in the project
> explorer of VS.net. The problem I have is that I am not
> using VS.net.
>
> Does anyone have an example of how to reference the dll in
> code that I can impliment through my text editor.