.net 执行 sql 语句
我的数据库中有存储过程p_backupdb现在要执行USEJARLINFOWKKexecp_backupdb@bkpath='e:',@bkfname='JARLINFO...
我的数据库中有 存储过程 p_backupdb 现在 要执行
USE JARLINFOWKK
exec p_backupdb @bkpath='e:',@bkfname='JARLINFOWKK_2012.bak'
像执行select delete ..语句那样用结果不成功
public bool Backups(string SQLstring)
{
try
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
using (SqlCommand cmd = new SqlCommand(SQLstring, connection))
{
connection.Open();
// int rows = Convert.ToInt32(cmd.ExecuteScalar().ToString());
connection.Close();
}
}
return true ;
}
catch (Exception s)
{
return false;
}
} 展开
USE JARLINFOWKK
exec p_backupdb @bkpath='e:',@bkfname='JARLINFOWKK_2012.bak'
像执行select delete ..语句那样用结果不成功
public bool Backups(string SQLstring)
{
try
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
using (SqlCommand cmd = new SqlCommand(SQLstring, connection))
{
connection.Open();
// int rows = Convert.ToInt32(cmd.ExecuteScalar().ToString());
connection.Close();
}
}
return true ;
}
catch (Exception s)
{
return false;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询