Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wierd Dec expected error on OledbConnection.Open

Status
Not open for further replies.

qwert231

Programmer
Sep 4, 2001
756
US
The line
Code:
objConn.Open()
is getting a 'Declaration expected' error. I cannot see what would need to be declared. Here is the code. So far I haven't been getting much response for my questions here. Please help?

Code:
<%@ Control Language=&quot;VB&quot; %>

<%@ import Namespace=&quot;System.Data&quot; %>
<%@ import Namespace=&quot;System.Data.OleDb&quot; %>
<script runat=&quot;server&quot;>

    Public strReq As String
    Public cnt As Integer
    Dim strResult, fldF As String
    Dim objConn As New OledbConnection(Application(&quot;dbAccess&quot;))
    Dim objComm As New OledbCommand (strReq, objConn)
    Dim objRead As OledbDataReader
    
    objConn.Open()
    objRead = objComm.ExecuteReader()
    
    strResult = &quot;<table><tr>&quot;
    Do While objRead.Read()
     For Each fldF in objRead.Fields
      strResult += &quot;<td>&quot; & fldF & &quot;</td>&quot;
     Next
    Loop
    strResult += &quot;<table><tr>&quot;
    objRead.Close()
    objConn.Close()
    
</script>    
<%= strResult %>
 
Wanted to add, I am using this as an ascx file. Here is how I'm using it in my file:
Code:
<%@ Register TagPrefix=&quot;UserControl&quot; TagName=&quot;testTable&quot; Src=&quot;colData.ascx&quot; %>
...
<USERCONTROL:testTable id=&quot;testTable&quot; strReq=&quot;SELECT * FROM Customers&quot; cnt=&quot;2&quot; runat=&quot;Server&quot;></USERCONTROL:Head>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top