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

sqlconnection string parameters

P: 1
Hi

I am a newbie to .NET and C#

I have been asked to maintain a website for a client and am having a problem with an SQL Connection. The error I get is on a page that displays the result of a search against an Access DB and is :

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'dataSet1' does not exist in the current context

Source Error:
Expand|Select|Wrap|Line Numbers
  1. Line 13:             <asp:image id="imgFace" style="Z-INDEX: 101; LEFT: 40px; POSITION: absolute; TOP: 88px" runat="server"
  2. Line 14:                 Width="90px" Height="125px"></asp:image><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 152px; POSITION: absolute; TOP: 96px" runat="server"
  3. Line 15:                 Width="96px" Height="24px">Last Name :</asp:label><asp:label id=LblName style="Z-INDEX: 103; LEFT: 312px; POSITION: absolute; TOP: 96px" runat="server" Width="176px" Height="24px" Text='<%# DataBinder.Eval(dataSet1, "Tables[Addresses].DefaultView.[0].LastName") %>'>
  4. Line 16:             </asp:label><asp:label id="Label2" style="Z-INDEX: 104; LEFT: 152px; POSITION: absolute; TOP: 192px" runat="server"
  5. Line 17:                 Width="128px" Height="24px">ACRICSA number:</asp:label><asp:label id=lblAcricsaNumber style="Z-INDEX: 105; LEFT: 312px; POSITION: absolute; TOP: 192px" runat="server" Width="184px" Height="24px" Text='<%# DataBinder.Eval(dataSet1, "Tables[Addresses].DefaultView.[0].AcricsaNumber") %>'>
The connection code that I downloaded from the live website is:

Expand|Select|Wrap|Line Numbers
  1. this.sqlConnection1.ConnectionString = "workstation id=extreme.gam.co.za;packet size=4096;user id=acricsa;password = acri" +
  2.                 "csa123;data source=10.0.0.45;persist security info=False;initial catalog=acricsa" +
  3.                 "";
Clearly this is directed to the current website location. I am trying to get this to run on my own PC (XP Pro - IIS and ASP.NET 2.0) and need help in chnaging the above parameters. The website is residing on my PC at "c:\inetpub\wwwroot\acricsa" and contains the Access database "acricsa.mdb" in the root segment. What do I need to change in the connection string?

BTW - I successfully changed the connection string on other search pages to:

Expand|Select|Wrap|Line Numbers
  1. this.oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=c:\\inetpub\\wwwroot\\acricsa\\acricsa.mdb";
I do not know why the authors chose to connect using SQL in my problem connection but it works on the live website.

Finally, is there a way of using relative URLs in these strings?

Thanks and Regards
Sep 18 '07 #1
Share this Question
Share on Google+
1 Reply


10K+
P: 13,264
Hi

I am a newbie to .NET and C#

I have been asked to maintain a website for a client and am having a problem with an SQL Connection. The error I get is on a page that displays the result of a search against an Access DB and is :


Expand|Select|Wrap|Line Numbers
  1. Line 13:             <asp:image id="imgFace" style="Z-INDEX: 101; LEFT: 40px; POSITION: absolute; TOP: 88px" runat="server"
  2. Line 14:                 Width="90px" Height="125px"></asp:image><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 152px; POSITION: absolute; TOP: 96px" runat="server"
  3. Line 15:                 Width="96px" Height="24px">Last Name :</asp:label><asp:label id=LblName style="Z-INDEX: 103; LEFT: 312px; POSITION: absolute; TOP: 96px" runat="server" Width="176px" Height="24px" Text='<%# DataBinder.Eval(dataSet1, "Tables[Addresses].DefaultView.[0].LastName") %>'>
  4. Line 16:             </asp:label><asp:label id="Label2" style="Z-INDEX: 104; LEFT: 152px; POSITION: absolute; TOP: 192px" runat="server"
  5. Line 17:                 Width="128px" Height="24px">ACRICSA number:</asp:label><asp:label id=lblAcricsaNumber style="Z-INDEX: 105; LEFT: 312px; POSITION: absolute; TOP: 192px" runat="server" Width="184px" Height="24px" Text='<%# DataBinder.Eval(dataSet1, "Tables[Addresses].DefaultView.[0].AcricsaNumber") %>'>
The connection code that I downloaded from the live website is:

Expand|Select|Wrap|Line Numbers
  1. this.sqlConnection1.ConnectionString = "workstation id=extreme.gam.co.za;packet size=4096;user id=acricsa;password = acri" +
  2.                 "csa123;data source=10.0.0.45;persist security info=False;initial catalog=acricsa" +
  3.                 "";
Clearly this is directed to the current website location. I am trying to get this to run on my own PC (XP Pro - IIS and ASP.NET 2.0) and need help in chnaging the above parameters. The website is residing on my PC at "c:\inetpub\wwwroot\acricsa" and contains the Access database "acricsa.mdb" in the root segment. What do I need to change in the connection string?

BTW - I successfully changed the connection string on other search pages to:

Expand|Select|Wrap|Line Numbers
  1. this.oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=c:\\inetpub\\wwwroot\\acricsa\\acricsa.mdb";
I do not know why the authors chose to connect using SQL in my problem connection but it works on the live website.

Finally, is there a way of using relative URLs in these strings?

Thanks and Regards
Maybe www.connectionstrings.com might help?
Sep 18 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.