当尝试通过ASP.NET在线连接到MSSQL数据库时,当两个或更多人同时连接时,我将得到以下信息:
ExecuteReader需要一个开放且可用的连接.连接的当前状态为"正在连接".
该站点在我的localhost服务器上正常工作.
这是粗略的代码.
public Promotion retrievePromotion()
{
int promotionID = 0;
string promotionTitle = "";
string promotionUrl = "";
Promotion promotion = null;
SqlOpenConnection();
SqlCommand sql = SqlCommandConnection();
sql.CommandText = "SELECT TOP 1 PromotionID, PromotionTitle, PromotionURL FROM Promotion";
SqlDataReader dr = sql.ExecuteReader();
while (dr.Read())
{
promotionID = DB2int(dr["PromotionID"]);
promotionTitle = DB2string(dr["PromotionTitle"]);
promotionUrl = DB2string(dr["PromotionURL"]);
promotion = new Promotion(promotionID, promotionTitle, promotionUrl);
}
dr.Dispose();
sql.Dispose();
CloseConnection();
return promotion;
}
Run Code Online (Sandbox Code Playgroud)
我可能知道可能出了什么问题,我该如何解决?
编辑:不要忘记,我的连接字符串和连接都是静态的.我相信这就是原因.请指教.
public static string conString = ConfigurationManager.ConnectionStrings["dbConnection"].ConnectionString;
public static SqlConnection conn …Run Code Online (Sandbox Code Playgroud) 我的.htacess中有以下代码,但它无法正常工作.是因为mod-rewrite没有"on",如果是这样,我该怎么检查?
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\$ $1.php [nc]
Run Code Online (Sandbox Code Playgroud)
我想重命名我的地址,例如:
http://www.abc.com - > http://www.abc.com
http://abc.com - > http://www.abc.com
http://www.abc.com/123.html - > http://www.abc.com/123
http://www.abc.com/12-12-12.html - > http://www.abc.com/12-12-12
http://subdomain.abc.com/123.html - > http://subdomain.abc.com/123
基本上删除扩展并确保其www完好无损.
编辑:
它被改写成了
Options +FollowSymlinks
RewriteEngine on
RewriteCond % ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteRule ^(.*).php $1
Run Code Online (Sandbox Code Playgroud)
但仍然没有工作