SQL CONNECTION
-
Hi all, when i run my application on a local PC to connect to SQL which is installed Locally i use the following config file. <configuration> <sqlServer>CelData</sqlServer> <sqlDatabase>mydatabase</sqlDatabase> <sqlUser>test</sqlUser> <sqlPassword>test</sqlPassword> <sqlTrusted>False</sqlTrusted> </configuration> However ,now i would like to connect to a database on remote PC (with different IP address).When i Run the application locally i would like to connect to the other server that is hosting the database. How would i change the above script so that the database is going to be the one on the remote server? Please advice. Thank you in advance.
-
Hi all, when i run my application on a local PC to connect to SQL which is installed Locally i use the following config file. <configuration> <sqlServer>CelData</sqlServer> <sqlDatabase>mydatabase</sqlDatabase> <sqlUser>test</sqlUser> <sqlPassword>test</sqlPassword> <sqlTrusted>False</sqlTrusted> </configuration> However ,now i would like to connect to a database on remote PC (with different IP address).When i Run the application locally i would like to connect to the other server that is hosting the database. How would i change the above script so that the database is going to be the one on the remote server? Please advice. Thank you in advance.
Take a look at connectionstrings.com[^], it has the correct information for most scenarios.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Take a look at connectionstrings.com[^], it has the correct information for most scenarios.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Thanks very much Henry.Its Much appreciated.I have tried to get around it.However it doesnt have something related to the one i am using the XMl data to get a connection to a database. Any Help in relation to the one i am using Please?
The XML that you are using simply breaks the connectionstring into its various parts. So the <sqlServer>CelData</sqlServer> line in your XML is the same as the
Server=myServerName\theInstanceName;
part in the examples on that site. The other parts of your XML, similarly match the other parts of the example (Database=, Trusted_Connection= etc.). You just have to use a little logic to work out which bit matches which part of the XML.Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
The XML that you are using simply breaks the connectionstring into its various parts. So the <sqlServer>CelData</sqlServer> line in your XML is the same as the
Server=myServerName\theInstanceName;
part in the examples on that site. The other parts of your XML, similarly match the other parts of the example (Database=, Trusted_Connection= etc.). You just have to use a little logic to work out which bit matches which part of the XML.Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
Sorry Henry ,I have tried to come up with it still got some error. Can you please give me a hint of one Connection string similar to the one below. <sqlServer>ServerName</sqlServer> <sqlDatabase></sqlDatabase> <sqlUser>sa</sqlUser> <sqlPassword>^1^g1xgwZxejDBJqb8FWQXYeQ==</sqlPassword> <sqlTrusted>False</sqlTrusted> <fileaccessDomain>c3</fileaccessDomain> <fileaccessUserName>Daniel</fileaccessUserName> <fileaccessUserPassword>^1^Rg+/IaL/Xa1KfZLSuaLN0Q==</fileaccessUserPassword> <ServerRoot>\\test\test\</ServerRoot> <VirtualRoot>BangRoot\</VirtualRoot> <FileFTPSite>BangMedia</FileFTPSite> <Folder>Operator Pictures</Folder>
-
Sorry Henry ,I have tried to come up with it still got some error. Can you please give me a hint of one Connection string similar to the one below. <sqlServer>ServerName</sqlServer> <sqlDatabase></sqlDatabase> <sqlUser>sa</sqlUser> <sqlPassword>^1^g1xgwZxejDBJqb8FWQXYeQ==</sqlPassword> <sqlTrusted>False</sqlTrusted> <fileaccessDomain>c3</fileaccessDomain> <fileaccessUserName>Daniel</fileaccessUserName> <fileaccessUserPassword>^1^Rg+/IaL/Xa1KfZLSuaLN0Q==</fileaccessUserPassword> <ServerRoot>\\test\test\</ServerRoot> <VirtualRoot>BangRoot\</VirtualRoot> <FileFTPSite>BangMedia</FileFTPSite> <Folder>Operator Pictures</Folder>
You have overcomplicated things. Pretty much all that you should have to do is change the <sqlServer> name, assuming that the databasename is the same, and the sqlPassword and sqlUser, if they are different. Something like this: <pre> <configuration> <sqlServer>RemoteServerName\SQLInstanceName</sqlServer> <sqlDatabase>Name of the Database you want on that server</sqlDatabase> <sqlUser>sa</sqlUser> <sqlPassword>^1^Rg+/IaL/Xa1KfZLSuaLN0Q==</sqlPassword> <sqlTrusted>False</sqlTrusted> </configuration></pre> where RemoteServerName, is the name of the remote server machine (or, I believe, its' IP Address. and SQLInstanceName is the name of the SqlServer Instance on that machine. e.g. on my local machine SQLInstanceName would be SQLExpress, because that is what I named it when I installed it.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”