[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Kevin Rourke

3/28/2002 5:09:00 AM

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.
2 Answers

Kevin Rourke

3/28/2002 5:41:00 AM

0

I found a partial answer in an earlier post.

I added :

<%@ Assembly Name="Microsoft.Data.ODBC" %>

under the import namespace. This still didn't do the trick
so I created a "bin" directory under the application
directory and placed the Microsoft.Data.ODBC.dll in this
folder.

>-----Original Message-----
>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.
>.
>

Scott Billsborough

4/4/2002 7:57:00 PM

0

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.