小新二三事 二三事 電視精/戲院 ASP .NET 新手工作日誌
顯示包含「ConnectionString」標籤的文章。顯示所有文章
顯示包含「ConnectionString」標籤的文章。顯示所有文章

2009年8月26日星期三

ASP.Net Code: Connection Strings with MS SQL server 2005

ASP.Net Code: Connection Strings with MS SQL server 2005

<remove name="LocalSqlServer">
<add name="LocalSqlServer" connectionstring="Data Source=localhost;Initial Catalog=aspnetdb;Integrated Security=True" providername="System.Data.SqlClient">
<add name="golddbConnectionString" connectionstring="Data Source=localhost;Initial Catalog=golddb;Integrated Security=True" providername="System.Data.SqlClient">

+

exec sp_grantloginaccess 'NT AUTHORITY\NETWORK SERVICE'
exce sp_addsrvrolemember @loginame = 'NT AUTHORITY\NETWORK SERVICE', @rolename = 'sysadmin'

2009年7月17日星期五

ASP.NET Code: www.qsh.eu ASPNETDB.MDF

ASP.NET Code: www.qsh.eu ASPNETDB.MDF


<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;Database=www.qsh.eu_8a547bfd-ce62-405a-bbfe-1628ac48aa15;AttachDBFilename=|DataDirectory|ASPNETDB.MDF" />
</connectionStrings>


http://forum.qsh.eu/Forums.aspx?forumid=25&threadid=79

http://forum.qsh.eu/Forums.aspx?searchtext=aspnet

http://www.cnblogs.com/hardrock/archive/2007/11/13/958546.html

ASP.NET Code: www.qsh.eu ConnectionString

ASP.NET Code: www.qsh.eu ConnectionString
For examle you have database "Test.mdf" created at SQL Server Management Studio Express.

1st step: your database must be detached from your SQL server correctly: open management studio -> right click on "Test" database -> Tasks -> Detach.

2nd step: create folder www/App_Data and copy Test.mdf without log file.

3 step: generate connection string at https://www.qsh.eu/admin/EditFreehosting.aspx and save in web.config.

4 step: replace name="LocalSqlServer" with (for example) name="DBAccess".

5 step: in code you can read connection string from web.config:

string connectionString = ConfigurationManager.ConnectionStrings["DBAccess"].ConnectionString;
IDbConnection connection = new SqlConnection(connectionString);
OR
replace name="DBAccess" with (for example) name="LocalSqlServer" in all ASPX
the stupid method i did once...

Login Link for www.qsh.eu
https://www.qsh.eu/admin/Login.aspx

免費asp.net空間(www.qsh.eu)使用詳解
http://www.0379zd.com/news/show/17001.htm

Qantasoft qsh.eu webconfig connectionString problem
http://forums.asp.net/p/1253493/2356606.aspx#2356606

2009年7月14日星期二

ASP.NET Code: SqlConnection with ConnectionString

ASP.NET Code: SqlConnection with ConnectionString
Dim SQLData As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\db.mdf;Integrated Security=True;User Instance=True")
Dim SQLData As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("
dbConnectionString
").ConnectionString)
from
http://www.aspnet101.com/aspnet101/tutorials.aspx?id=64