Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: CompilerOptions


Message #1 by "Datatal AB - Gauffin, Jonas" <Jonas@d...> on Fri, 12 Apr 2002 14:24:50 +0200
Hello

I've created an ASP.NET application that uses MySQL
through ODBC.Net

I've added a reference to Microsoft.Data.Odbc by
rightclicking on "References" in the solution explorer.

Everything works fine if I add a CompilerOptions line in
my ASPX page, but not without it.
<%@ CompilerOptions=3D'/R:"C:\Program
Files\Microsoft.Net\Odbc.Net\Microsoft.Data.Odbc.dll"' %>

My question is: Why do I still have to add a
CompilerOptions line to my aspx-page. I though that adding
a reference in my project was enough?


'why do I need this line???
<%@ CompilerOptions=3D'/R:"C:\Program 
Files\Microsoft.Net\Odbc.Net\Microsoft.Data.Odbc.dll"' %>

<%@ Import Namespace=3D"System.Data" %>
<%@ Import Namespace=3D"Microsoft.Data.Odbc" %>  'should this one be 
enough?
<html>
   <head>
      <link rel=3D"stylesheet"href=3D"intro.css">
   </head>

   <script language=3D"VB" runat=3Dserver>
       Sub Page_Load(Src As Object, E As EventArgs)

 			Dim DS As DataSet
			Dim MyConnection As OdbcConnection =3D New 
OdbcConnection("driver=3D{MySQL};server=3D127.0.0.1;uid=3Droot;pwd=3D;dat
abase=3Dsupport3;OPTION=3D17923")
			Dim sql As String =3D "select * from case_info"
			Dim MyCommand As OdbcDataAdapter =3D New OdbcDataAdapter(sql, 
MyConnection)

			DS =3D New DataSet()
			MyCommand.Fill(DS, "case_info")


			MyList.DataSource =3D DS.Tables("case_info").DefaultView
			MyList.DataBind()


       End Sub
   </script>
   <body>
       <center>
       <form action=3D"intro8.aspx" method=3D"post" runat=3D"server" 
ID=3D"Form1">
           <ASP:DataGrid id=3D"MyList" HeaderStyle-BackColor=3D"#aaaadd" 
BackColor=3D"#ccccff" runat=3D"server"/>
       </form>
       </center>
   </body>
</html>

//Jonas

  Return to Index