How to Connect to a Remote Database from a WebService?
-
Hi THere, as the subject says, I'm writing a webservice and would like to connect to a database. [WebMethod] public ClientData[] GetClientData(int Number){ } I'm not sure how to connect. Can someone please let me know the steps required to connect to a Remote database? Thanks
-
Hi THere, as the subject says, I'm writing a webservice and would like to connect to a database. [WebMethod] public ClientData[] GetClientData(int Number){ } I'm not sure how to connect. Can someone please let me know the steps required to connect to a Remote database? Thanks
It is just like connecting to a remote database from your application means in the connection string you have to give the database systemname on which system it is deployed ,like its systemname or IP address. For example in ur connection string u have provide the parametres like Sqlconnection _connetcion=new sqlconnection("Server=SystemName;Initial Catalog=DatabaseName;User Id=sa; Password=;") I hope this will works for you. More over give this connection strings in your web.config file so that you can refer it all over the function and mainatainace will be easier if your database is moved to other systems in the future. Sorry for my poor english :) Happy programming. Cheers,
-
Hi THere, as the subject says, I'm writing a webservice and would like to connect to a database. [WebMethod] public ClientData[] GetClientData(int Number){ } I'm not sure how to connect. Can someone please let me know the steps required to connect to a Remote database? Thanks
Connecting to a database from a web service shouldn't be any different than a regular app.
"Find it your bloody self - immediately!" - Dave Kreskowiak