[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Connect Mysql by using ODBC in the Asp.net

willy@brocomm.com.cn

4/24/2002 7:04:00 AM

2 Answers

Ramon

4/24/2002 1:00:00 PM

0

Chris

4/25/2002 7:34:00 AM

0

you need to incluse the assembly and reference to odbc.net

<%@ CompilerOptions='/R:"C:\Program
Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.dll"' %>
<%@ Import Namespace = "Microsoft.Data.Odbc" %>

When you are using the code behind:

When your project is open in visual studio.net

1. Click on the project
2. Add reference
3. On the .net tab double click ("Microsoft.Data.ODBC.dll")
4. Click OK
5. At the very top of your vb page type ("Imports Microsoft.Data.ODBC")

The basics are you need to refererence the odbc.net dll

P.S I give you no promisses but try this at the top of your page.

<%@ CompilerOptions='/R:"C:\Program
Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.dll"' %>
<%@ Import Namespace = "Microsoft.Data.Odbc" %>
<willy@brocomm.com.cn> wrote in message news:uXXt5006BHA.2456@tkmsftngp05...
I have created a Project of Asp.net to connect the MySql through ODBC.net
code:

</script>
<LINK href="Styles.css" type="text/css" rel="stylesheet">
<script language="vb" runat="server">

Sub Page_load(ByVal Src As Object, ByVal E As EventArgs)

Dim strCnn As String
Dim strSql As String

'strCnn =
"DRIVER={MySQL};Server=192.168.0.110;Port=3306;uid=root;pwd=;Database=netvis
ion2"
strCnn =
"DRIVER={SQLServer};Server=willy;uid=videoshow;pwd=videoshow;Database=videos
how"
dim myCnn = New OdbcConnection()
myCnn.connetionstring=strcnn
strSql = "select * from tbuser"
dim myCmd = New OdbcCommand(strSql, myCnn)
myCnn.Open()

dim myAda = New OdbcDataAdapter()
myAda.SelectCommand = myCmd
dim myDS = New DataSet()
myAda.Fill(myDS, "Program")

myDataGrid.DataSource = myDS.Tables("program").DefaultView
' myDataGrid.databind()
End Sub
</script>
<body onload="return window_onload()">
<P><asp:datagrid id="myDataGrid" style="FONT-SIZE: 8pt" runat="server"
align="center" HeaderStyle-BackColor="#ffcc66" Width="70%" CellPadding="2"
ShowFooter="False" BorderColor="Gray"
BackColor="#FFFFC0"></asp:datagrid></P>
<P align="center"><FONT face="ËÎÌå" color="#800080"><A
href="PageData.aspx"><U>http://localhost/WebAppTest/PageData.aspx</U></A></F
ONT></P>
</body>
</HTML>

When I build it , the error acur appear.

Compiler Error Message: BC30002: Type 'OdbcConnection' is not defined.

error in
dim myCnn = New OdbcConnection()

what can i do.