connection-string

Can't open a connection to SQL Server 2005 from a pocketpc (windows mobile 6)

不羁岁月 提交于 2019-12-06 02:18:36
I'm trying to connect from a pocket pc app (windows mobile 6) to a SQL Server 2005, but no matter how hard I try it didn't work. I checked every possible configuration for enabling tcp on SQL Server, I tested many connection strings, but still have the problem when I attempt to open the connection, I'm sure it's not a network issue because I can ping on my pocket pc from the server machine without any problem and the firewall on my server machine is disabled : here is one of the connection strings I used : Data Source=10.168.0.160,1433;Initial Catalog=pos;Trusted_connection=yes;user id

How To Change The Connection String saved in My.Settings in VB 2010

折月煮酒 提交于 2019-12-06 01:33:51
I am writting an application and I used Wizard to create DataSets which auto-created their own xml code. This code uses the saved in My.Settings Connection String. Being a setting with an unchangable 'Application' scope i cannot change its value at runtime. The problem is that when I install the Application to my customer the Connection String will have to change (maybe more than once). So is there a way to change the Connection String used by these objects at runtime ? CoderDennis Here's how to edit the setting via code: My.Settings.Item("ConnectionString") = "some connection string" However,

Accessing ConfigurationManager.AppSettings value from Spring.NET xml configuration

元气小坏坏 提交于 2019-12-06 00:56:27
问题 I have a requirement that requires me to use Spring.net to get a connectionstring that is stored inside the app.config, and then inject the retrieved connectionstring to a instantiated object. How can I do this using Spring.net's xml configuration? For e.g., instead of my codes doing this: // Spring.net config: <object name="myService" type="com.acme.MyService, com.acme"> <constructor-arg type="System.String" value="myConnectionName"/> </object> // Web.config: <connectionStrings> <add name=

Parsing a Connection String

拈花ヽ惹草 提交于 2019-12-05 22:04:41
Is there a standard library or code snippet to get a value with a connection string like this? string connstr = "DataServiceUrl=http://localhost/foo;" + "RemoteServerConnection={server=http://localhost/foo2;interface=0.0.0.0;};" + "publisherport=1234;StatisticsURL=http://localhost/foo3"; The whole inner connection property is kind of throwing this in a loop. I'd like to get specific values based on a key. Here was the answer posted by John I used: System.Data.Odbc.OdbcConnectionStringBuilder builder = new System.Data.Odbc.OdbcConnectionStringBuilder(); builder.ConnectionString = this

C# SqlCommand Connection.Open() issue

独自空忆成欢 提交于 2019-12-05 18:20:54
I have a C# ASP.NET web application an I am trying to populate an ASP:DropDownList with a column in a database table. My Code: using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Web.Configuration; namespace CRM2Sage { public partial class SOPOrderEntry : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Fill1(); } public void Fill1() { SqlCommand cmd = new SqlCommand("SELECT * FROM Products", new SqlConnection

Apostrophe (single quote) in connection string

。_饼干妹妹 提交于 2019-12-05 17:06:01
I'm having a trouble with the ' character in a connection string. Entity Framework throws an exception saying: Format of the initialization string does not conform to specification starting at index I tried the answers suggested here and here to no avail. I also tried constructing it with SqlConnectionStringBuilder class and got the same exception as a result. Can anyone help me out? Thanks in advance. EDIT: The connectionstring is indeed in the web.config file and it looks like this: <add name="TestEntities" connectionString="metadata=res://*/DAL.TestModel.csdl|res://*/DAL.TestModel.ssdl|res:

Changing your web.config from your ASP.NET application

不羁的心 提交于 2019-12-05 15:37:40
I need to change the database connection string in the web.config file but havent got a clue how to go about this. Does anyone have any experience with that? UPDATE Sorry, not very clear above, I want to be able to change a connection string from the web application after it has been deployed Configuration myConfiguration = WebConfigurationManager.OpenWebConfiguration("~"); //appSettings configuration myConfiguration.AppSettings.Settings["xxx"].Value = "yyy"; //database connections configuration myConfiguration.ConnectionStrings.ConnectionStrings["xxxconnection"].ConnectionString = "yyy";

How to fix “'ServerVersion' threw an exception of type 'System.InvalidOperationException'”? [duplicate]

邮差的信 提交于 2019-12-05 14:23:40
This question already has answers here : C# console application Invalid Operation Exception (6 answers) Closed 2 months ago . I have got a local SQL Server DB, up and running, and I am trying to connect to it in a seemingly failproof way: new SqlConnection(@"Server=(localdb)\v12.0;Integrated Security=true;Database=MyDBName;"); However, this line throws an exception: "'ServerVersion' threw an exception of type 'System.InvalidOperationException'"? What could I do to fix it? I have run sqllocaldb create "v12.0" but it seems to make no difference. Step 1: go to WebConfig File and Write this Code:

Azure does not override application settings

徘徊边缘 提交于 2019-12-05 11:54:32
In my Azure App Service I want to update application settings, but after publish from VS the keys doesn't override values from local Web.config In Azure it looks like: In the result my web.config on azure contains values from local settings <connectionStrings> <add name="MainConnectionString" connectionString="ConnectionStringToReplaceByAzure" providerName="System.Data.SqlClient" /> </connectionStrings> <appSettings> <add key="MS_SigningKey" value="Overridden by portal settings" /> </appSettings> Azure never physically modifies your web.config file. Instead, the Azure App Setting is injected

Code first migrations - what connection string will it use?

自闭症网瘾萝莉.ら 提交于 2019-12-05 11:51:55
问题 Code first migrations have been working very well for me. I have a services project and a wpf project. The model is in the services project which is referenced by the wpf project. Update-database is done on the services project, but uses connection string from the wpf project. I now add a web project which also references the service project. So now that there is a connection string in the app.config and there is one in the web.config, which one will it use? 回答1: In my scenario, the app