sqlconnection string parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • trandel
    New Member
    • Sep 2007
    • 1

    sqlconnection string parameters

    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:
    Code:
    Line 13: 			<asp:image id="imgFace" style="Z-INDEX: 101; LEFT: 40px; POSITION: absolute; TOP: 88px" runat="server"
    Line 14: 				Width="90px" Height="125px"></asp:image><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 152px; POSITION: absolute; TOP: 96px" runat="server"
    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") %>'>
    Line 16: 			</asp:label><asp:label id="Label2" style="Z-INDEX: 104; LEFT: 152px; POSITION: absolute; TOP: 192px" runat="server"
    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:

    Code:
    this.sqlConnection1.ConnectionString = "workstation id=extreme.gam.co.za;packet size=4096;user id=acricsa;password = acri" +
    				"csa123;data source=10.0.0.45;persist security info=False;initial catalog=acricsa" +
    				"";
    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\www root\acricsa" and contains the Access database "acricsa.md b" 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:

    Code:
    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
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by trandel
    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 :


    Code:
    Line 13: 			<asp:image id="imgFace" style="Z-INDEX: 101; LEFT: 40px; POSITION: absolute; TOP: 88px" runat="server"
    Line 14: 				Width="90px" Height="125px"></asp:image><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 152px; POSITION: absolute; TOP: 96px" runat="server"
    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") %>'>
    Line 16: 			</asp:label><asp:label id="Label2" style="Z-INDEX: 104; LEFT: 152px; POSITION: absolute; TOP: 192px" runat="server"
    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:

    Code:
    this.sqlConnection1.ConnectionString = "workstation id=extreme.gam.co.za;packet size=4096;user id=acricsa;password = acri" +
    				"csa123;data source=10.0.0.45;persist security info=False;initial catalog=acricsa" +
    				"";
    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\www root\acricsa" and contains the Access database "acricsa.md b" 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:

    Code:
    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.connections trings.com might help?

    Comment

    Working...