在ADO。NET中怎么用存储过程啊? http://www.yesky.com/20021112/1639498.shtml这有个例子,在Visual Basic .NET中使用存储过程。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 thisConnection = new SqlConnection( @"server = CELERON\SQL2000;"+ "integrated Security = sspi;"+ "Database = Northwind"); thisConnection.Open(); cmd = thisConnection.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_Select_AllEmployees"; dr = cmd.ExecuteReader(); zxzt.Text = "成功查询无参数存储过程 sp_Select_AllEmployees "; 看看这个是否有用OleDbCommand comm = new OleDbCommand("",Class.PubObject.DBConnObj); comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "InvoiceInfo"; comm.Parameters.Add("@financeMonth",OleDbType.WChar).Value = this.comboBoxYear.Text+this.comboBoxMonth.Text; comm.Parameters.Add("@accountID",OleDbType.WChar).Value = aimTree.SelectedNode.Tag.ToString(); comm.ExecuteNonQuery(); //执行存储过程,PUB_SYS_LOG为存储过程名public static bool InsertGMonitorLog(int sysPrgId,string logType,ing logOperationMsg){ bool blnRst = false; 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(); blnRst = true; } catch(SqlException e) { e.ToString(); } finally { myConn.Close(); } return blnRst;} 新手求帮助 异常处理问题 连接sql数据库的一个小问题 用contextMenustrip实现右键菜单在ActiveX中无法显示出来 (100分)怪事,晕了 一个菜鸟的问题!! C#里的变量参数是怎么用的? 如何用C#设计支持脚本编辑的测试执行程序? 被C#虐了好多天了,小女子求教各位大神,在C#中如何实现将两张t图片相减,并将差异显示出来? 如果取这个字符串里的字符? 怎么判断“空格”这个字符 数据删除的问题,急,高手请帮忙,谢谢了
@"server = CELERON\SQL2000;"+
"integrated Security = sspi;"+
"Database = Northwind");
thisConnection.Open();
cmd = thisConnection.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_Select_AllEmployees";
dr = cmd.ExecuteReader();
zxzt.Text = "成功查询无参数存储过程 sp_Select_AllEmployees ";
OleDbCommand comm = new OleDbCommand("",Class.PubObject.DBConnObj);
comm.CommandType = CommandType.StoredProcedure;
comm.CommandText = "InvoiceInfo";
comm.Parameters.Add("@financeMonth",OleDbType.WChar).Value = this.comboBoxYear.Text+this.comboBoxMonth.Text;
comm.Parameters.Add("@accountID",OleDbType.WChar).Value = aimTree.SelectedNode.Tag.ToString();
comm.ExecuteNonQuery();
public static bool InsertGMonitorLog(int sysPrgId,string logType,ing logOperationMsg)
{
bool blnRst = false;
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();
blnRst = true;
}
catch(SqlException e)
{
e.ToString();
}
finally
{
myConn.Close();
}
return blnRst;
}