Problem dimming connString in user control.

Results 1 to 2 of 2

Thread: Problem dimming connString in user control.

  1. #1
    Join Date
    Dec 1969

    Default Problem dimming connString in user control.

    I have an .aspx page that I am trying to convert to an ascx user control. The .aspx page runs great. When I convert it to an ascx it craps out on line 9.<BR>&#060;error&#062;<BR>Compilation Error <BR>Compiler Error Message: BC30188: Declaration expected.<BR>Source Error:<BR>Line 7: <BR>Line 8: Dim connString as String<BR>Line 9: connString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:inetpubwwwrootdotnetprojectcontact.mdb"<B R><BR> I am trying to declare my connection string outsite of a sub routine so it will be available throughout the control. Again, the code below runs fine in the aspx page, but bombs out on the "connString=..." bit when converted to an ascx usercontrol.<BR>&#060;code snip&#062;<BR>&#060;%@ Control Language="VB" %&#062;<BR>&#060;%@ import Namespace="System.Data" %&#062;<BR>&#060;%@ import Namespace="System.Data.OleDb" %&#062;<BR><BR>&#060;script runat="server"&#062;<BR><BR>Dim connString as String<BR>connString="Provider=Microsoft.Jet.OLEDB .4.0;Data Source=c:inetpubwwwrootdotnetprojectcontact.mdb"<B R><BR> Sub Page_Load(Src As Object, E As EventArgs) <BR> If Not (IsPostBack)<BR> BindGrid()<BR> End If <BR> End Sub<BR>&#060;/code snip&#062;<BR><BR>Any thoughts? Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: Problem dimming connString in user control.

    Try the keyword &#039;Protected&#039; instead of &#039;Dim&#039;.<BR><BR>hth, Bizz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts