Database Connection in asp.net
-
Hi all , I have created an asp.net application and my database is on another system.I want to connect that database to my application from that another system using the webconfig file. How can i do it ? Thanks in advance.
define the connection string in web.config under appsettigns tag like;
<appsettigns>
<add key="name" value"Data Source=remote pc name; uid=userid; password=sqlserverpassword;Initial Catalog=Database name"/>
</appsettigns></pre>
or U can use the connection string tag also.
call the same is ur cs or vb file using configuration managaer class.
-
Hi all , I have created an asp.net application and my database is on another system.I want to connect that database to my application from that another system using the webconfig file. How can i do it ? Thanks in advance.
sarang_k wrote:
I want to connect that database to my application from that another system using the webconfig file.
I didn't get you. What is the problem you facing to connect the db which in another system? define the connectionstring in web.config properly
Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators
-
define the connection string in web.config under appsettigns tag like;
<appsettigns>
<add key="name" value"Data Source=remote pc name; uid=userid; password=sqlserverpassword;Initial Catalog=Database name"/>
</appsettigns></pre>
or U can use the connection string tag also.
call the same is ur cs or vb file using configuration managaer class.
yes i have done using this but now the problem is when i am writing insert query it is not inserting the data into the database. But if i open sql server management studio and execute the query it is inserting. can u tell me how to solve it. Thanks in advance.
-
yes i have done using this but now the problem is when i am writing insert query it is not inserting the data into the database. But if i open sql server management studio and execute the query it is inserting. can u tell me how to solve it. Thanks in advance.
Ok, then tell me the error. or if possible the show the code.
-
Ok, then tell me the error. or if possible the show the code.
there is no error. Main problem is it is not inserting in to the table.how to define the datasource of that another pc.can u give me an example or is there any thing we have to set properties or give access.And i am using sql server 2008. Thanks in advance.
-
there is no error. Main problem is it is not inserting in to the table.how to define the datasource of that another pc.can u give me an example or is there any thing we have to set properties or give access.And i am using sql server 2008. Thanks in advance.
Nothing has to be define, If the problem is in insert query the connection has no problem. it will be inserted in the same manner it inserts with the local database. just define the connection in your command statement SqlCommand sql=new SqlCommand(str,con) will work fine. Or check with ur user credential for login into sql database. sa has right and the other user not then also the insert could be failed.
-
Hi all , I have created an asp.net application and my database is on another system.I want to connect that database to my application from that another system using the webconfig file. How can i do it ? Thanks in advance.
first check the database tht if you can access from your system using sqlserver management studio. If yes There will be no problem just specify the correct connect string as brij suggested.
LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.
-
Hi all , I have created an asp.net application and my database is on another system.I want to connect that database to my application from that another system using the webconfig file. How can i do it ? Thanks in advance.
You may select, insert or update the queries in the Sql Server Management Studio, but not from the application. Just check whether the application is having right access to do the manipulations in db. This might be the problem, even though the connection string is correct.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.