By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,396 Members | 2,501 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,396 IT Pros & Developers. It's quick & easy.

ODBC Problems

P: n/a
I'm trying to test my ODBC connection. I need to use ODBC because of the
application restrictions. As per Microsoft directions for the known ODBC
error, I created a bin folder in my application directory. I'm assuming
my application directory is where I have my .ASPX page, right? I'm
getting the error:
There can be only one 'page' directive. Help appreciated.

<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ CompilerOptions='/R:"C:\Program
Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.d ll"' %>
<%@ import Namespace="Microsoft.Data.ODBC" %>
<script runat="server">

Sub Page_Load(source As Object, E As EventArgs)

Dim cn as OdbcConnection
cn = New OdbcConnection
("dsn=SOTAMAS90AUTO;uid=TRY;pwd=Turux;")
Dim mystring As String = "Select * AR1_CustomerMaster"
Dim cmd As OdbcCommand = New OdbcCommand(mystring)
cn.Open()
MsgBox("Connected")
cn.Close()
End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<!-- Insert content here -->
</form>
</body>
</html>
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
CompilerOptions is Page directive attribute so you need to put it with
the Page directive. As the error message says you can't declare more
then one page directive on a page.

<%@ Page Language="VB" CompilerOptions='/R:"C:\Program
Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.d ll"'%>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="Microsoft.Data.ODBC" %>
<script runat="server">
HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.