在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;} vs2008报表与webservice 急:远程获取服务器上web文件信息 SOCKET开发的疑问! .net中同一种问题两种方法的区别 何让Comobox读取文本文档里的数据 通过ServiceProcess启动其他程序,并显示出来!+ 高分!!! 借人气一问,关于手机号码的,权当娱乐(版主不要删啊) Datatable中Dynamic Linq query的问题,高手进! 关于类的问题请教高高手帮一个忙好吗?在线等待 哪位老大用过GridEx,在GridEx中新增的一行中途取消要如何做?急...救命... 怎么判断“空格”这个字符 数据删除的问题,急,高手请帮忙,谢谢了
@"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;
}