我有一个 asp.net 网络应用程序。使用普通连接字符串调用数据库,远程服务器报错,本地服务器运行正常,怎么办?
public class MainClass
{
public SqlConnection getcon()
{
SqlConnection con = new SqlConnection("Data Source=b*****;Initial Catalog=**;Persist Security Info=True;User ID=***;Password=**; MultipleActiveResultSets=True" );
return con;
}
并且 Login.aspx 包含
public partial class Login : System.Web.UI.Page
{
MainClass obj = new MainClass();
protected void bt_login_Click(object sender, EventArgs e)
{
SqlConnection con = obj.getcon();
con.Open();
}