我这里应该不涉及用户权限,和GetAllPages存储过程不存在的问题。因为我全都是以sa用户创建的
9 个解决方案
#1
这是我前台调用代码
public bool insertUnit(string UnitName, string UnitPhone, string UnitAdress, string UnitNumber, string UnitDetails, int UserID, string UserName)
{
using (SqlConnection con = new SqlConnection(ConnectionHelper.ConnectionString))
{
con.Open();
string ProceName = "GetAllPages";
SqlCommand cmd = new SqlCommand(ProceName,con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@UnitName",SqlDbType.NVarChar,50));
cmd.Parameters["@UnitName"].Value = UnitName;
cmd.Parameters.Add(new SqlParameter("@UnitPhone", SqlDbType.NVarChar, 50));
cmd.Parameters["@UnitPhone"].Value = UnitPhone;
cmd.Parameters.Add(new SqlParameter("@UnitAdress", SqlDbType.NVarChar, 100));
cmd.Parameters["@UnitAdress"].Value = UnitAdress;
cmd.Parameters.Add(new SqlParameter("@UnitNumber", SqlDbType.NVarChar, 50));
cmd.Parameters["@UnitNumber"].Value = UnitNumber;
cmd.Parameters.Add(new SqlParameter("@UnitDetails", SqlDbType.Text));
cmd.Parameters["@UnitDetails"].Value = UnitDetails;
cmd.Parameters.Add(new SqlParameter("@UserID", SqlDbType.Int));
cmd.Parameters["@UserID"].Value = UserID;
cmd.Parameters.Add(new SqlParameter("@UserName", SqlDbType.NVarChar,50));
cmd.Parameters["@UserName"].Value = UserName;
cmd.Parameters.Add(new SqlParameter("@output", SqlDbType.Int));
cmd.Parameters["@output"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
int Result = int.Parse(cmd.Parameters["@output"].Value.ToString());
if (Result > 0)
{
return true;
}
else
{
return false;
}
}
}
public bool insertUnit(string UnitName, string UnitPhone, string UnitAdress, string UnitNumber, string UnitDetails, int UserID, string UserName)
{
using (SqlConnection con = new SqlConnection(ConnectionHelper.ConnectionString))
{
con.Open();
string ProceName = "GetAllPages";
SqlCommand cmd = new SqlCommand(ProceName,con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@UnitName",SqlDbType.NVarChar,50));
cmd.Parameters["@UnitName"].Value = UnitName;
cmd.Parameters.Add(new SqlParameter("@UnitPhone", SqlDbType.NVarChar, 50));
cmd.Parameters["@UnitPhone"].Value = UnitPhone;
cmd.Parameters.Add(new SqlParameter("@UnitAdress", SqlDbType.NVarChar, 100));
cmd.Parameters["@UnitAdress"].Value = UnitAdress;
cmd.Parameters.Add(new SqlParameter("@UnitNumber", SqlDbType.NVarChar, 50));
cmd.Parameters["@UnitNumber"].Value = UnitNumber;
cmd.Parameters.Add(new SqlParameter("@UnitDetails", SqlDbType.Text));
cmd.Parameters["@UnitDetails"].Value = UnitDetails;
cmd.Parameters.Add(new SqlParameter("@UserID", SqlDbType.Int));
cmd.Parameters["@UserID"].Value = UserID;
cmd.Parameters.Add(new SqlParameter("@UserName", SqlDbType.NVarChar,50));
cmd.Parameters["@UserName"].Value = UserName;
cmd.Parameters.Add(new SqlParameter("@output", SqlDbType.Int));
cmd.Parameters["@output"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
int Result = int.Parse(cmd.Parameters["@output"].Value.ToString());
if (Result > 0)
{
return true;
}
else
{
return false;
}
}
}
#2
和客户端连接的库及登陆的用户有关,不行就加 dbo.GetAllPages
#3
客户端什么用户登录的
#4
第一、就否是同一个库?
不是什么智力问题
不是什么智力问题
#5
你调用存储过程的时候是怎么调用的?
#6
string ProceName = "GetAllPages";-----存储过程名称
SqlCommand cmd = new SqlCommand(ProceName,con);
cmd.CommandType = CommandType.StoredProcedure;
SqlCommand cmd = new SqlCommand(ProceName,con);
cmd.CommandType = CommandType.StoredProcedure;
#7
不是同一个数据库?
#8
我是一个库,我在数据库查询分析器上面,可以执行,不报错
#9
[数据库].[用户].[存储过程]
#1
这是我前台调用代码
public bool insertUnit(string UnitName, string UnitPhone, string UnitAdress, string UnitNumber, string UnitDetails, int UserID, string UserName)
{
using (SqlConnection con = new SqlConnection(ConnectionHelper.ConnectionString))
{
con.Open();
string ProceName = "GetAllPages";
SqlCommand cmd = new SqlCommand(ProceName,con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@UnitName",SqlDbType.NVarChar,50));
cmd.Parameters["@UnitName"].Value = UnitName;
cmd.Parameters.Add(new SqlParameter("@UnitPhone", SqlDbType.NVarChar, 50));
cmd.Parameters["@UnitPhone"].Value = UnitPhone;
cmd.Parameters.Add(new SqlParameter("@UnitAdress", SqlDbType.NVarChar, 100));
cmd.Parameters["@UnitAdress"].Value = UnitAdress;
cmd.Parameters.Add(new SqlParameter("@UnitNumber", SqlDbType.NVarChar, 50));
cmd.Parameters["@UnitNumber"].Value = UnitNumber;
cmd.Parameters.Add(new SqlParameter("@UnitDetails", SqlDbType.Text));
cmd.Parameters["@UnitDetails"].Value = UnitDetails;
cmd.Parameters.Add(new SqlParameter("@UserID", SqlDbType.Int));
cmd.Parameters["@UserID"].Value = UserID;
cmd.Parameters.Add(new SqlParameter("@UserName", SqlDbType.NVarChar,50));
cmd.Parameters["@UserName"].Value = UserName;
cmd.Parameters.Add(new SqlParameter("@output", SqlDbType.Int));
cmd.Parameters["@output"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
int Result = int.Parse(cmd.Parameters["@output"].Value.ToString());
if (Result > 0)
{
return true;
}
else
{
return false;
}
}
}
public bool insertUnit(string UnitName, string UnitPhone, string UnitAdress, string UnitNumber, string UnitDetails, int UserID, string UserName)
{
using (SqlConnection con = new SqlConnection(ConnectionHelper.ConnectionString))
{
con.Open();
string ProceName = "GetAllPages";
SqlCommand cmd = new SqlCommand(ProceName,con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@UnitName",SqlDbType.NVarChar,50));
cmd.Parameters["@UnitName"].Value = UnitName;
cmd.Parameters.Add(new SqlParameter("@UnitPhone", SqlDbType.NVarChar, 50));
cmd.Parameters["@UnitPhone"].Value = UnitPhone;
cmd.Parameters.Add(new SqlParameter("@UnitAdress", SqlDbType.NVarChar, 100));
cmd.Parameters["@UnitAdress"].Value = UnitAdress;
cmd.Parameters.Add(new SqlParameter("@UnitNumber", SqlDbType.NVarChar, 50));
cmd.Parameters["@UnitNumber"].Value = UnitNumber;
cmd.Parameters.Add(new SqlParameter("@UnitDetails", SqlDbType.Text));
cmd.Parameters["@UnitDetails"].Value = UnitDetails;
cmd.Parameters.Add(new SqlParameter("@UserID", SqlDbType.Int));
cmd.Parameters["@UserID"].Value = UserID;
cmd.Parameters.Add(new SqlParameter("@UserName", SqlDbType.NVarChar,50));
cmd.Parameters["@UserName"].Value = UserName;
cmd.Parameters.Add(new SqlParameter("@output", SqlDbType.Int));
cmd.Parameters["@output"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
int Result = int.Parse(cmd.Parameters["@output"].Value.ToString());
if (Result > 0)
{
return true;
}
else
{
return false;
}
}
}
#2
和客户端连接的库及登陆的用户有关,不行就加 dbo.GetAllPages
#3
客户端什么用户登录的
#4
第一、就否是同一个库?
不是什么智力问题
不是什么智力问题
#5
你调用存储过程的时候是怎么调用的?
#6
string ProceName = "GetAllPages";-----存储过程名称
SqlCommand cmd = new SqlCommand(ProceName,con);
cmd.CommandType = CommandType.StoredProcedure;
SqlCommand cmd = new SqlCommand(ProceName,con);
cmd.CommandType = CommandType.StoredProcedure;
#7
不是同一个数据库?
#8
我是一个库,我在数据库查询分析器上面,可以执行,不报错
#9
[数据库].[用户].[存储过程]