问题描述
我想使用带c#的asp.net编码在数据库实时服务器上创建数据库,请帮帮我.
I want to create the database on database live server using asp.net coding with c# please help me.
String str;
//String CONN = "Data Source=ERP3\\SQLEXPRESS;Integrated Security=True;";
String CONN = "server=Admin;uid=sa;pwd=sa;";
SqlConnection myConn = new SqlConnection(CONN);
//str = "CREATE DATABASE test ON PRIMARY " +
// "(NAME = MyDatabase_Data, " +
// "FILENAME = ''C:\\MyDatabase_Data.mdf'', " +
// "SIZE = 2MB, FILEGROWTH = 10%) " +
// "LOG ON (NAME = MyDatabase_Log, " +
// "FILENAME = ''C:\\MyDatabase_Data.ldf'', " +
// "SIZE = 1MB, " +
// "MAXSIZE = 5MB, " +
// "FILEGROWTH = 10%)";
str = "CREATE DATABASE testHgtech ";
SqlCommand myCommand = new SqlCommand(str, myConn);
try
{
myConn.Open();
myCommand.ExecuteNonQuery();
//MessageBox.Show("DataBase is Created Successfully", "MyProgram", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (System.Exception ex)
{
//MessageBox.Show(ex.ToString(), "MyProgram", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally
{
if (myConn.State == ConnectionState.Open)
{
myConn.Close();
}
}
}
字符串CONN ="server = Admin; uid = sa; pwd = sa;";
上面的代码我正在与本地服务器进行通信,它正在为实时服务器使用相同的代码,但无法正常工作
我正在使用上面的代码在实时服务器上创建数据库,但是该数据库在本地服务器上运行,但在实时服务器上无法运行,请帮帮我.
请帮助我
String CONN = "server=Admin;uid=sa;pwd=sa;";
the above code i am using for connentivity with local server it is working the same code for live server it is not working
I am using above code to create the database on live server but it is working on local server but not working on live server please help me.
plz help me
推荐答案
String CONN = "server=Admin;uid=sa;pwd=sa;";
您确定这是实时服务器吗?
它看起来不太像,但我可能是错的...
尝试连接到您知道的实时数据库,而不是本地数据库,然后进行检查.使用连接字符串连接到真实的实时服务器.
您确定要将测试数据库放在实时生产服务器上吗?数据库管理员知道吗?
Are you sure this is the live server?
It doesn''t look much like it, but I could be wrong...
Try connecting to a database you know is live, rather than local, and check that. Use the connection string to connect to your real, live server.
Are you sure you want to put test databases on your live production server? Does the DB admin know?
这篇关于通过使用asp.net witdh c#进行编码在服务器上创建数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!