简单的存储过程的调用 C#简单的存储过程调用,简单登陆功能就好,谢谢!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 SqlCommand _cmd = new SqlCommand(); _cmd.Connection=_con; _cmd.CommandText = "存储过程名称"; _cmd.CommandType=CommandType.StoredProcedure; _cmd.ExecuteNonQuery(); 有参数的话 SqlCommand _cmd = new SqlCommand(); _cmd.Connection=_con; _cmd.CommandText = "存储过程名称"; _cmd.CommandType=CommandType.StoredProcedure; _cmd.Parameters.Add(new SqlParameter(参数名,类型,值)); _cmd.ExecuteNonQuery(); //执行存储过程,PUB_SYS_LOG为存储过程名public static void InsertGMonitorLog(int sysPrgId,string logType,ing logOperationMsg){ SqlConnection myConn = new SqlConnection(strConn); SqlCommand myComm = new SqlCommand("PUB_SYS_LOG",myConn); myComm.CommandType = CommandType.StoredProcedure; SqlParameter myPara = new SqlParameter("@SYS_PRG_ID",SqlDbType.Int); myPara.Value = sysPrgId; myComm.Parameters.Add(myPara); myPara = new SqlParameter("@LOG_TYPE",SqlDbType.VarChar,3); myPara.Value = logType; myComm.Parameters.Add(myPara); myPara = new SqlParameter("@LOG_OPERATION_MSG",SqlDbType.VarChar,50); myPara.Value = logOperationMsg; myComm.Parameters.Add(myPara); try { myConn.Open(); myComm.ExecuteNonQuery(); } catch(SqlException e) { e.ToString(); } finally { myConn.Close(); }}Creating an ADO.NET Universal Data Wrapperhttp://www.15seconds.com/issue/040127.htm 如果得到“链接名称(name)” TCP/IP监听 正则表达式问题 请教高手!timr`listvew`禁下拉滚动条! MSDN上不了?你们能上不? 关于反编译 ~~~~~~~~~~~~~视频会议问题~~~~~~~~~~ c#访问局域网其他计算机上的access库问题 C#的事件处理机制与VC相比有什么优势? 有关c#的一个多线程问题。解决马上给分儿! winfrom 如何运行script? int i = 10;int j = 10; 如何解除这样题啊?
_cmd.Connection=_con;
_cmd.CommandText = "存储过程名称";
_cmd.CommandType=CommandType.StoredProcedure;
_cmd.ExecuteNonQuery();
SqlCommand _cmd = new SqlCommand();
_cmd.Connection=_con;
_cmd.CommandText = "存储过程名称";
_cmd.CommandType=CommandType.StoredProcedure;
_cmd.Parameters.Add(new SqlParameter(参数名,类型,值));
_cmd.ExecuteNonQuery();
{
SqlConnection myConn = new SqlConnection(strConn);
SqlCommand myComm = new SqlCommand("PUB_SYS_LOG",myConn);
myComm.CommandType = CommandType.StoredProcedure; SqlParameter myPara = new SqlParameter("@SYS_PRG_ID",SqlDbType.Int);
myPara.Value = sysPrgId;
myComm.Parameters.Add(myPara); myPara = new SqlParameter("@LOG_TYPE",SqlDbType.VarChar,3);
myPara.Value = logType;
myComm.Parameters.Add(myPara); myPara = new SqlParameter("@LOG_OPERATION_MSG",SqlDbType.VarChar,50);
myPara.Value = logOperationMsg;
myComm.Parameters.Add(myPara);
try
{
myConn.Open();
myComm.ExecuteNonQuery();
}
catch(SqlException e)
{
e.ToString();
}
finally
{
myConn.Close();
}
}Creating an ADO.NET Universal Data Wrapper
http://www.15seconds.com/issue/040127.htm