Newbie Q Regarding Opening A Connection To A Database
Jan 2, 2005
Hello, Im new with databases.
I know that opening a connection to a DB is expensive. Usually I write a method that opens a connection to the DB then I execute a query and then close the connection. Pretty standard.
OK, so how do I handle opening connections to the database when I need to run multiple queries. For example, i have a webpage that need to query the database to see if the user has moderator privledges, then depending on that query I have to query the DB again for moderator specific information or non-modertaor information.
So in this case how do i handle opening connections to the DB. Is it ok to generally have to open a connection to a DB multiple times on a page load?
The obvious solution is to keep the connection open. That is, open a connection, query the Db, keep the connection open, do the conditional statment ( if is_Moderator) then query the DB again for the info that I need, and then close the connection. But, from all the books that Ive been reading this is not a good practice because business logic should not been in the dataAccess layer.
Now I have the execute selectquerry function..... public static SqlDataReader ExecuteSelectQuerry(string querry) { try { SqlConnection conn = OpenConnection(); SqlCommand scomm = new SqlCommand(querry, conn); SqlDataReader sdr = scomm.ExecuteReader(); return sdr;
} catch (Exception e) { return null; } }}
now my question is....the instance of conn is limited only to that function only, and not returned outside. Whereas only the SqlDataReader is returned outside. Does that have any abnormal affect on the application. Since my ASP Application is getting locked (not doing anything, nt even post back!) sometimes after a few DB operation.
Arent these connections and instances Managed (auto garabage collection)?? Can memory leaks under such a situation occur. Please help
I have created my query to do what it needs to do but i'm getting error when i click the button, it says there is an error opening my connectiong.... I.E. Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.Source Error:
Line 28: Line 29: //open the connection Line 30: myConnection.Open(); Line 31: Line 32: //create a commandSource File: c:Documents and SettingsplanPlanDatabaseBZAvuAdd.aspx.cs Line: 30 Stack Trace:
Hi most of my code follows the following format in a lot of my pages, my question is; Am i approaching it the right way in terms of performance, sql injection attacks and anything someone more knowledgeable than myself can think off, please feel free to criticise the code. Thank youprotected void Page_Load(object sender, EventArgs e) {string strID = Request.QueryString["id"]; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["streamConnectionString"].ConnectionString);SqlCommand command = new SqlCommand("stream_EventsByID", conn); command.CommandType = CommandType.StoredProcedure;command.Parameters.Add("@eventID", SqlDbType.Int).Value = Request.QueryString["id"]; conn.Open(); SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection); eventList.DataSource = reader; eventList.DataBind(); conn.Close(); } }
Hi there I sorry if I have placed this query in the wrong place. I'm getting to grips with ASP.net 2, slowly but surely! When i try to access my site which uses a Sql Server 2005 express DB i am receiving the following error:
Server Error in '/jarebu/site1' Application.
Database 'd:hostingmemberasangaApp_DataASPNETDB.mdf' already exists.Could not attach file 'd:hostingmemberjarebusite1App_DataASPNETDB.MDF' as database 'ASPNETDB'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Database 'd:hostingmemberasangaApp_DataASPNETDB.mdf' already exists.Could not attach file 'd:hostingmemberjarebusite1App_DataASPNETDB.MDF' as database 'ASPNETDB'.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
This is the connection string that I am using: <connectionStrings> <add name="ConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|ASPNETDB.MDF;Integrated Security=True;Initial Catalog=ASPNETDB;User Instance=True" providerName="System.Data.SqlClient"/> </connectionStrings>
The database is definitly in the folder that the error message relates to. What I'm finding confusing is that the connection string seems to be finding "aranga"s database. Is it something daft?
I'm developing an intranet site in ASP.NET 2.0 but I can't seem to connect to the DB from within my code. I've created a .vb class that houses a private Connection() that other functions within the class can call to connect to the database. In the calling function, I've declared my connection object and called the "Open" method on the object. However, when I attempt to execute the stored procedure command by calling the "ExecuteScalar" method, I get the following error: "ExecuteScalar requires an open and available Connection. The connection's current state is closed." Here's the code from my class: Imports System.Data Imports System.Data.SqlClient Namespace Encompass Public Class EncompassSecurity Public Shared Function GetHRIDByNTUserID(ByVal strNTUserID) As String Dim strHRID As String 'Create command object Dim cmd As New SqlCommand("usp_Get_HRID_By_NTUserID", Connection()) cmd.CommandType = CommandType.StoredProcedure 'Open DB connection Dim DBConnection As SqlConnection = Connection() DBConnection.Open() 'Input parameters Dim inNTUserParam As New SqlParameter("@NT_UserID", SqlDbType.VarChar) inNTUserParam.Direction = ParameterDirection.Input inNTUserParam.Value = strNTUserID cmd.Parameters.Add(inNTUserParam) 'Output parameters Dim outHRIDParam As New SqlParameter("@HRID", SqlDbType.Int) outHRIDParam.Direction = ParameterDirection.Output cmd.Parameters.Add(outHRIDParam) 'Run stored procedure strHRID = cmd.ExecuteScalar() Return (strHRID) 'Close DB connection DBConnection.Close() End Function Private Shared Function Connection() As SqlConnection Dim strConnectionString As String strConnectionString = ConfigurationManager.ConnectionStrings("Conn").ConnectionString Return New SqlConnection(strConnectionString) End Function End Class End Namespace Here's the code from my web.config file: <?xml version="1.0"?> <!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in WindowsMicrosoft.NetFrameworkv2.xConfig --> <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <connectionStrings> <add name="Conn" connectionString="Data Source=ServerName;Initial Catalog=NPASDV;uid=UserName;password=*******;" providerName="System.Data.SqlClient" /> </connectionStrings>
<system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. Visual Basic options: Set strict="true" to disallow all data type conversions where data loss can occur. Set explicit="true" to force declaration of all variables. --> <roleManager defaultProvider="AspNetWindowsTokenRoleProvider" /> <compilation debug="true" strict="false" explicit="true" /> <pages> <namespaces> <clear /> <add namespace="System" /> <add namespace="System.Collections" /> <add namespace="System.Collections.Specialized" /> <add namespace="System.Configuration" /> <add namespace="System.Text" /> <add namespace="System.Text.RegularExpressions" /> <add namespace="System.Web" /> <add namespace="System.Web.Caching" /> <add namespace="System.Web.SessionState" /> <add namespace="System.Web.Security" /> <add namespace="System.Web.Profile" /> <add namespace="System.Web.UI" /> <add namespace="System.Web.UI.WebControls" /> <add namespace="System.Web.UI.WebControls.WebParts" /> <add namespace="System.Web.UI.HtmlControls" /> </namespaces> </pages> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows" />
<!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> </system.web> </configuration> What am I doing wrong? Any help would be most appreciated!! Manuel
When the databse file's "copy to output" property is set to "copy always" my data is not saved and when I change it to "do not copy" it gives me the error "cannot attach the database file", and does not open my connection. I dont know what to do.....
i have a loop that can run say 30k times. in there i am using the try / catch / finally blocks to handle ADO.NET Transactions (thanks CADDRE!)Should i open and close the SQL Connection for each record? or open it and close it outside of the loop only once ?thanks in advance, mcm
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() at WebService1.Service1.HelloWorld() in g:inetpubwwwrootwebservice1service1.asmx.cs:line 120
My guess is that something in the web.config isn't right or maybe the host (webfusion) is strange. Thanks if anyone can help.
I have a application running on Biztalk server , VS 2008 and SQL server 2008.
I have opened a SQL connection string and referring some DB which works absoluetly fine.
But in my code in C#, i try to open another connection with some different database, as i apply the connection.open(), it gives me a very strange error of Sql server 2005. And i dont have Sql 2005 on my box.
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53)
I am getting the error message below when trying to connect to SQL Server 2000. Here are the details:
Problem is occuring with a new website trying to connect to SQL Server. The error occurs right at the open statement. Using SQL Server 2000 Web server is on a different machine than SQL Server I have many websites connecting to this SQL Server. Websites are all on the same webserver. I can connect to this SQL Server using the Query Analyzer using the same ID and PW as in my connection string My web application runs OK using this SQL Server when I run it from my laptop - just changed the connection string Initial Catalog parameter. Any help would be appreciated. Jay --- Error Message An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
(Hope this isn't a "stupid" question, but I haven't been able to find a straight-forward answer anywhere)" I currently have code that iterates through a dataview's records, making a change to a field in some of the records. The way I have this coded, a conection has to opened & closed for each individual record that's updated: dsrcUserIae.UpdateCommand = "UPDATE UserIAE SET blnCorrect = @blnCorrect WHERE (ID = @ID)" dsrcUserIae.UpdateParameters.Add("blnCorrect", SqlDbType.Bit) dsrcUserIae.UpdateParameters.Add("ID", SqlDbType.Int) Dim myDataView As DataView = CType(dsrcUserIae.Select(DataSourceSelectArguments.Empty), DataView) For Each myRow As DataRowView In myDataView If myRow("FkUsersAnswerID") = myRow("AnswerID") Then intCorrect = 1 Else intCorrect = 0 End If dsrcUserIae.UpdateParameters.Item("blnCorrect").DefaultValue = intCorrect dsrcUserIae.UpdateParameters.Item("ID").DefaultValue = myRow("ID") intUpdateResult = dsrcUserIae.Update() Next It seems like I should be able to do something like this (call update once), but I'm not sure how... dsrcUserIae.UpdateCommand = "UPDATE UserIAE SET blnCorrect = @blnCorrect WHERE (ID = @ID)" dsrcUserIae.UpdateParameters.Add("blnCorrect", SqlDbType.Bit) dsrcUserIae.UpdateParameters.Add("ID", SqlDbType.Int) Dim myDataView As DataView = CType(dsrcUserIae.Select(DataSourceSelectArguments.Empty), DataView) For Each myRow As DataRowView In myDataView If myRow("FkUsersAnswerID") = myRow("AnswerID") Then myRow("blnCorrect") = 1 Else myRow("blnCorrect") = False End If Next intUpdateResult = dsrcUserIae.Update() 'Want all changed myRow("blnCorrect") to be updated to datasource Can anybody explain how to do the bulk update? I've seen some info about AcceptChanges and Merge, but I'm not sure if they apply here, or if they more for Transactions.
I'm writing an application with Visual Studio 2005 (Visual Basic .NET 2.0) which uses a SQL Compact Edition 3.5 database. On my HTC Touch with Windows Mobile 6.1 installed the application crashes, without any error message, if I try to open a connection. But...On the Windows Mobile 6 Pro emulator the connection opens normaly. The whole application runs perfect. On both "devices" are the same dll's, of version 3.5.0.0.
I'm using the following code to open the connection:
Dim localConnection As New SqlCeConnection(mySQLce_strConnection) localConnection.Open()
I tried so many things but without any success. But...I'm able to open the database (MControl_SQLce.sdf) with the Query Analyzer 3.5 on the Mobile. No problem.
This is my configuration: Dev PC: Windows XP SP2 Visual Studio 2005 Pro .NET Framework 2.0 SP1 .NET Compact Framework 2.0 SQL Server Compact Edition 3.5 (this version I reference to in my VS project)
Mobile Device (HTC Touch): Windows Mobile 6.1 SQL Server Compact Edition 3.5
Hello everyone. I'm very new to asp.net. I've been coding in vb.net for a while now (getting my associates degree in desktop application programming) and my boss wants all of my new applications to be web based now. Well, i decided to take some initiative on this and begin a new project for my department. This is a very small project. So far, everything is coming along alright (i found an eBook that's helped me quite a bit). Everything was cool until yesterday when i tried to connect to our sql server database. I get an error message stating:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
Because i'm testing this on my system as well as the remote system which hosts the application, i can see the error message on the remote system. Here is the error it's giving me:
Server Error in '/' Application. --------------------------------------------------------------------------------
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
Source Error:
Line 57: sConnString = "Server=F11602A2120564OPS;Initial Catalog=OpsMonitor;User ID='public';Password=;Integrated Security=SSPI;"'Connection String Line 58: sConn = New SqlConnection(sConnString)'Initialize New Connection Line 59: sConn.Open'Open the connection Line 60: End Sub Line 61: </script>
[SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474 System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372 System.Data.SqlClient.SqlConnection.Open() +383 ASP.atm_reporting_aspx.OpenConn() in c:inetpubwwwrootatm_reporting.aspx:59 ASP.atm_reporting_aspx.Page_Load(Object Src, EventArgs E) in c:inetpubwwwrootatm_reporting.aspx:23 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +731
You can see my SQL Connection string in there as well. Can someone please help me with this? I can post the code to the entire page as well if that would help. I'm developing this with Dreamweaver MX 2004 (i like dreamweaver MUCH better than visual studio, especially for web design/development). Thanks,
I am getting an error in Replication between SQL Server 2005 and SQL Express when "Connecting to Subscriber". Detailed error message is given below. Do we need to increase the logintimeout for "Connecting to Subscriber". How can we increase it?
Message 2007-10-15 06:37:58.398 Startup Delay: 8503 (msecs) 2007-10-15 06:38:06.898 Connecting to Distributor 'ACR-MANGO' 2007-10-15 06:38:06.976 Initializing 2007-10-15 06:38:06.976 Parameter values obtained from agent profile: -bcpbatchsize 2147473647 -commitbatchsize 100 -commitbatchthreshold 1000 -historyverboselevel 1 -keepalivemessageinterval 300 -logintimeout 15 -maxbcpthreads 1 -maxdeliveredtransactions 0 -pollinginterval 5000 -querytimeout 1800 -skiperrors -transactionsperhistory 100 2007-10-15 06:38:06.991 Connecting to Subscriber 'ACR-ANJILISQLEXPRESS' 2007-10-15 06:38:46.133 Agent message code 20084. The process could not connect to Subscriber 'ACR-ANJILISQLEXPRESS'. 2007-10-15 06:38:46.148 Category:NULL Source: Microsoft SQL Native Client Number: 08001 Message: Unable to complete login process due to delay in opening server connection 2007-10-15 06:38:46.148 The agent failed with a 'Retry' status. Try to run the agent at a later time.
I'm having a problem writing a connection string in .NET. I'm trying to use:
SqlConnection myConnection = new SqlConnection("Provider=SQLOLEDB;Data Source=mssql;Initial Catalog= cat;UserId=ddd;Password=ddd;");
which unfortunately is giving me:
SQL Server does not exist or access denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Can someone tell me what I'm doing wrong? Thanks in advance!
Hi,I am getting this error when i am connecting sql database.Error = "SQL Server does not exist or access denied."Can you please suggest me where i am going wrong.RegardsNaveen
I am an SQL user from the development side, this is the first time I have been tasked to set up SQL Server. So far so good, although I'm having some issues finding the information I am normally familiar with to build a connection string to our database server.
1) We are on a dedicated server with a hosting company. They did not provide us with a licence for SQL Server 2005, so we had to install SQL Server 2005 Express. So far everything is going well, I have:
- gone through the proceedure to enable remote access to the database
- installed the Northwind test database
- installed msSQL Server Management Studio express, and I can see the db components.
I usually use Enterprise Manager to connect to and construct/manage my databases - however I am usually provided the connection string information.
- I have the database set to Windows Authentication Mode.
So my questions -
1. What is the connection string format to use (with .asp)? i usually use the following:
2. How do I find my server name? currently, in the database manager it shows as "WDC202SQLEXPRESS (SQL SERVER 9.0.2047 - WDC202USERNAME)" - where USERNAME is our current username. The system Databases and Northwind are listed below.
When i try to register using the above format connection string with Enterprise Manager, I get the connection not found or login. so my last question -
3. When i am setting up my connection string, should i be using the same user/pass set that logs me into the server - i am assuming this is the Windows Authentication credentials Ive set in the Server install.
Hi everybody, I am using VB Webforms as my front end and MSDE 2000 as my back end. I am not able to drop a database after executing the following vb code on that database: Dim vConnection As New SqlConnection(vConnectionString) Dim vAdapter As New SqlDataAdapter("SELECT party_type_code, party_type_name, party_type_imported" & _ " FROM Party_Type" & _ " ORDER BY party_type_name", vConnection) Dim vDataTable As New DataTable() vAdapter.Fill(vDataTable) vAdapter.Dispose() vConnection.Dispose() On trying to drop the database using the SQL Command "DROP DATABASE PPCABCD2005", I get the error message:Cannot drop the database 'PPCABCD2005' because it is currently in use ...However, if I don't execute the above code, I am able to drop it. Why is it so? What is the solution to this problem?
Hi there I dunno if this is the correct place to ask this.I got this database that is part of application, I need to convert/migrate it to any other current database like SQL server, the problem is that I dunno the database type, with his current application I know it got stored names and address, from the application I can only export 9999 records at the same time.The database is a 300mb DAT file.I have never done anything like this before so Any help or suggestions would be apreciatte, ty.Database opened with Index Data Suite:http://b.imagehost.org/0096/index_data_suite.jpgDatabase opened with Hex Editor:http://b.imagehost.org/0096/hex_pic.jpg
I am try to create an application (WPF) that uses data from an SQL server database via a web service, all localized on my computer in a virtual folder. The program work fine, it can retrieve the data from the database.
The problem arises when I want to open the same database with server explorer in VS2008 or with SQL server management studio.
Once I have used my application those two programs are not able any more to establish a connection with the database inviting me to close the program that is using the database. Even if I shut down my application and the full project those to program can not open it. I need to switch the computer off.
My application closes and dispose the connection as soon as the data have been retrieved.
The connection string that I am using is the following:
I am trying to call a stored procedure to insert into my database. After I called Open(), it crashed on ExecuteNonQuery(). I get the following message.
Object must implement IConvertible. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Object must implement IConvertible.
Source Error:
Line 160:Try Line 161:myConnection.Open() Line 162:myCommand.ExecuteNonQuery() Line 163:myConnection.Close()
What does this mean? If anyone encountered this error before, please let me know how to trace the error and fix it.
The application uses Merge Replication. The error occurs in the Synchronise() Method of the SqlCeReplication object.
"SQL Server Mobile encountered problems when opening the database."
repl.AddSubscription(AddOption.ExistingDatabase) repl.Synchronize() I also checked the the connection string and it seems to be fine. Both my device and server can ping each other. Moreever I can also access the Web syncronization folder(on server) from the device.Is anyone having a resolution for this?
Hello! I'm trying to connect a sql ce database from a PPC with WM 2003 to a sql server 2005 database.
I discover the class SqlCeRemoteDataAccess, so i've been trying, unsucessfuly, to get things working.
I googled a lot, i read Ms Articles from MSDN, i read some posts here, but can't find solution for my problem. As you can see in my code, i already tryed different aprroaches, differente connections strings, with "provider", without "provider", with "sspi", without "sspi", you name it...
I configure the sql server agent like i read in msdn, and he's working well, i'm able to see the message. ("Microsoft SQL Server Compact Edition Server Agent" when i open the url).
The sql database credentials are correct, i already check that.
I did everything i knew and i read, unfortunately i still can't manage to find a solution for an error message:
"SQL Server Mobile encountered problems when opening the database." The native error is 28559
That's an Exception error message, that appears to me.
The application uses Merge Replication. The error occurs in the Synchronise() Method of the SqlCeReplication object.
"SQL Server Mobile encountered problems when opening the database."
repl.AddSubscription(AddOption.ExistingDatabase) repl.Synchronize() I also checked the the connection string and it seems to be fine. Both my device and server can ping each other. Moreever I can also access the Web syncronization folder(on server) from the device.Is anyone having a resolution for this?
I'll try and ask one more time. Does anyone have a clue how to fix this?
"A SQL Server Compact Edition DLL could not be loaded. Reinstall SQL Server Compact Edition. [ DLL Name = sqlceca30.dll ]"
or
"SQL Server Compact Edition encountered problems when opening the database" "Internal error: The database is not initialized."
I've been fighting this for well over a week now. My XP based version works fine but this error occurs routinely on my CE4.2 device. I cannot find anything meaningful using Google other than 'look for non disposed' replication objects which I've done. Is this bad hardware? I don't believe I'm out of memory as the app is about 1.2MB including about 8 DLL's and GC indicates I have about 300KB of objects at the time of the failure. I also use a bunch of static (global) objects that I use throughout the code.
It would be nice if I could get the lower level error messages causing these failures but that is probably too much to ask.
The odd thing is that it's only the replication engine that fails as even after the failure, the app can reopen the DB and work with the data just fine.
My basic order of the application is...
1 Open DB SqlCEConnection 2 Create/Prepare any SqlCECommand objects 3 Do work here 4 Dispose any SqlCECommand objects 5 Close DB 6 Dispose SqlCEConnection object 7 Create SqlCEReplication object 8 BeginSynchronize 9 ... error here.. 10 Dispose SqlCEReplication object 11 Reopen DB SqlCEConnection
I've tried creating the Replication object at program start and that does not help. I'm guessing there is something about .net that I don't understand either with stack space, # dll's or whatever. I've rearranged the order of the Dispose, Create, SQL CE objects to include just about every permutation but still am hitting this same problem.
Are there any tools that can help me profile this app for memory problems or usage? Everything seems geared for .Net and not .NetCF.
I added a connection (ADO.NET) object by name testCon in the connection manager - I wanted to programmatically supply the connection string. So I used the "Expressions" property of the connection object and set the connectionstring to one DTS variable. The idea is to supply the connection string value to the variable - so that the connection object uses my connection string.
Then I added a "Backup Database Task" to my package with the name BkpTask. Now whenever I try to set the connection property of BkpTask to the testCon connection object, by typing testCon, it automatically gets cleared. I am not able to set the connection value.
Then after spending several hours I found that this is because I have customized the connection string in testCon. If I don't customize the connection string, I am able to enter the "testCon" value in the connection property of the BkpTask.
When opening .sql files, I get a connect to database engine prompt every single time. how to stop this from prompting vs. just using my current active connection?
I have a solution with a couple of ssis projects in it. Everytime I open the solution, Visual Studio creates an extra .database file for the project's existing xxx.database file. The solution is under VSS control and VS2005 checks out the project and shows the file as a newly added file.
What causes this and how can I prevent this from occurring?
There are 2 of us working on the solution and the other fellow does not see this behavior.
The files do not show up in the VS2005 solution explorer. If they are user specific as I suspect (impersonation info?), then they should not be added to the .dtproj project file.