473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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:
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
1 1588
r035198x
13,262 8TB
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

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

Similar topics

1
by: huzz | last post by:
I have a method that gets sqldatareader as shown below.. my question is how do i close the sqlconnection (objConn) object within this method? If i put the objconn.Close(); after the return then i...
3
by: sck10 | last post by:
Hello, I have a stored procedure that requires 3 parameters. How do you add multiple parameters for a SqlConnection? Thanks, Steven Public strConn = "Data Source=MyServer;Initial...
3
by: Ludvig | last post by:
This Exception is executed when using SQLConnection. OleDbConnection connects fine. System.EnterpriseServices.Platform.Initialize() +503...
10
by: bnob | last post by:
Im my ASP.net project I do a lot of connection to the SQL Server Database. I use a global variabe for my connection declare in a module (VB.Net code behind) All is ok but when I start a form...
2
by: MrMike | last post by:
I have a web.config file containing the SQLConnection String to a SQL Database. Before I implemented this SQLConnection String into web.config, I had individual SQLConnection objects in each...
2
by: Nils Magnus Englund | last post by:
Hi, I've made a HttpModule which deals with user authentication. On the first request in a users session, it fetches data from a SQL Server using the following code: using (SqlConnection...
4
by: Victor | last post by:
Hi Guys I have a problem here. I want to improve the performance for a website. When I looked into the system, I have found that the system made the "SqlConnection Object" static. That mean only...
8
by: JoeW | last post by:
I normally use SqlConnection, SqlDataReader, SqlCommand for most of my queries but recently a friend of mine who is a long time java programmer suggested I use the IDbConnection, IDbCommand...
7
by: =?Utf-8?B?UmJydA==?= | last post by:
I am developing a asp.net 2.0 app using vb and am thinking about using the system cache to cache a sqlconnection. However, I am concerned there might be implications to this which are not obvious....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.