C++ ADO 命令对象调用 MySql 的二进制类型的输出参数的存储过程时,用户必须预先提供长度信息吗? [问题点数:200分,结帖人zjs100901]

Bbs6
本版专家分:5292
Blank
黄花 2013年1月 其他开发语言大版内专家分月排行榜第二
2012年12月 其他开发语言大版内专家分月排行榜第二
结帖率 94.44%
Bbs1
本版专家分:78
Blank
GitHub 绑定GitHub第三方账户获取
vc的ado调用存储过程,带有字符串类型输出参数
语句是这样:rn[code=SQL]select a from a_table where ad_id = 0010101rn[/code]这时候a是唯一的字符串。rn那么我要怎么在<em>存储过程</em>中写,才能让这个字符串<em>输出</em>呢?rn以及在vc的<em>ado</em>中要怎样写呢?
ADO调用存储过程如何得到输出参数
[code=SQL]_CommandPtr cmd;rncmd.CreateInstance("ADODB.Command");rnParametersPtr pParamRk;rnpParamRk = cmd->GetParameters();rn rnpParamRk->Append(cmd->CreateParameter(_bstr_t("vphone"),adVarChar, adParamInput, 6500, _variant_t(strPhoneList)));//输入<em>参数</em>rnpParamRk->Append(cmd->CreateParameter(_bstr_t("vMsg"), adBSTR, adParamInput, 720, _variant_t(strMsg)));rnpParamRk->Append(cmd->CreateParameter(_bstr_t("icount"),adInteger, adParamInput, 4, _variant_t((long)nCnt)));rnpParamRk->Append(cmd->CreateParameter(_bstr_t("vSubNo"),adBSTR, adParamInput, 10, _variant_t(strtSubNo)));rnpParamRk->Append(cmd->CreateParameter(_bstr_t("iErrorCode"), adBSTR, adParamOutput, 20, _variant_t(strErrCode)));//<em>输出</em><em>参数</em>rnpParamRk->Append(cmd->CreateParameter(_bstr_t("vUserId"),adBSTR, adParamInput, 11, _variant_t(strUserId)));rnrntryrnrncmd->CommandTimeout = 5;rncmd->ActiveConnection = m_pConnection;rncmd->CommandText = "proc_SendSms"; rncmd->CommandType = adCmdStoredProc;rncmd->Execute(NULL, NULL, adCmdStoredProc); rn rncatch(...)rnrn[/code]rnrn部分代码如上,应该如何获取<em>输出</em><em>参数</em>iErrorCode的值呢?
ado调用参数为游标类型存储过程
<em>存储过程</em>是一个查询,有一个游标<em>类型</em>的返回值,具体如下:rnrn[code=sql]CREATE OR REPLACE PACKAGE Body DotNet isrn --***************************************************************************************rn PROCEDURE DotNetPaginationrn (rn Pindex in number,rn Psql in varchar2,rn Psize in number,rn Pcount out number,rn v_cur out type_currn )rn ASrn v_sql VARCHAR2(4000);rn v_count number;rn v_Plow number;rn v_Phei number;rn Beginrn ------------------------------------------------------------取分页总数rn v_sql := 'select count(*) from (' || Psql || ')';rn execute immediate v_sql into v_count;rn Pcount := ceil(v_count/Psize);rn ------------------------------------------------------------显示任意页内容rn v_Phei := Pindex * Psize + Psize;rn v_Plow := v_Phei - Psize + 1;rn --Psql := 'select rownum rn,t.* from cd_ssxl t' ; --要求<em>必须</em>包含rownum字段rn --v_sql := 'select * from (' || Psql || ') where rn between ' || v_Plow || ' and ' || v_Phei ;rnrn v_sql := 'SELECT *rn FROM (rn SELECT A.*, rownum rnrn FROM ('|| Psql ||') Arn WHERE rownum = ' || to_char(v_Plow) ;rn --注意对rownum别名的使用,第一次直接用rownum,第二次一定要用别名rnrnrnrn open v_cur for v_sql;rn End DotNetPagination;rn[/code]rnrn我要在VC++中使用ADO获取查询到的数据,如何获取返回的游标?rnrn我<em>调用</em><em>存储过程</em>的代码:rnrn[code=c]_CommandPtr pCmd = NULL;rn pCmd.CreateInstance(__uuidof(Command));rnrn _ParameterPtr strSql = NULL;rn strSql.CreateInstance(__uuidof(Parameter));rnrn _ParameterPtr nindexPage = NULL;rn nindexPage.CreateInstance(__uuidof(Parameter));rnrn _ParameterPtr npageSize = NULL;rn npageSize.CreateInstance(__uuidof(Parameter));rnrn _ParameterPtr npageCount = NULL;//<em>存储过程</em>返回值,返回总页数rn npageCount.CreateInstance(__uuidof(Parameter));rnrn //_ParameterPtr ncursor = NULL;rn //ncursor.CreateInstance(__uuidof(Parameter));rn _RecordsetPtr rs;rn rs.CreateInstance(__uuidof(Recordset));rnrn tryrn rn /*rn * 各<em>参数</em>赋值rn */rn _variant_t vt;rn vt.SetString("2");rnrn nindexPage = pCmd->CreateParameter(_bstr_t("nindexPage"),adInteger,adParamInput,sizeof(int),(VARIANT)vt);rn nindexPage->Value = _variant_t(nIndexPage);rn pCmd->Parameters->Append(nindexPage);rnrn strSql = pCmd->CreateParameter(_bstr_t("strSql"),adVarChar,adParamInput,pSql.GetLength(),(VARIANT)vt);rn strSql->Value = _variant_t(pSql);rn pCmd->Parameters->Append(strSql);rnrnrn npageSize = pCmd->CreateParameter(_bstr_t("npageSize"),adInteger,adParamInput,sizeof(int),(VARIANT)vt);rn npageSize->Value = _variant_t(nPageSize);rn pCmd->Parameters->Append(npageSize);rnrnrn npageCount = pCmd->CreateParameter(_bstr_t("npageCount"),adInteger,adParamOutput,sizeof(int),(VARIANT)vt);rn pCmd->Parameters->Append(npageCount);rnrn pCmd->ActiveConnection = m_pConnection;rn pCmd->CommandText = "CALL DotNet.DotNetPagination(?,?,?,?)";rn pCmd->CommandType = adCmdText;rnrn rs = pCmd->Execute(NULL,NULL,adCmdText|adCmdUnspecified);rn[/code]rnrn这段代码执行到rs = pCmd->Execute(NULL,NULL,adCmdText|adCmdUnspecified);这里时总是catch到错误,错误代码为#3092,请问如何获取游标返回值
ado调用mysql存储过程,带输出参数,出错。
不知道为什么有<em>输出</em><em>参数</em>就出错。
ADO调用存储过程参数的处理
_variant_t vReValue;rnvReValue.vt = VT_INT;rnvReValue.iVal =-77;rnrn_CommandPtr cmd;rn hr = cmd.CreateInstance (__uuidof(Command));rn if(FAILED(hr))rn rn return FALSE;rn rnrncmd->ActiveConnection = m_pConnection;rn cmd->CommandType = adCmdStoredProc; rn cmd->CommandText = "test_param"; rn cmd->Parameters ->Append (rn cmd->CreateParameter (_bstr_t("myparam"),rn adInteger,rn adParamInput,rn 0,rn &vReValue)rn );rnrn cmd->Execute (&vNull, &vNull,adCmdUnknown);rn<em>存储过程</em>在执行时传入<em>参数</em>有误rn另:如要取out<em>参数</em>,如何编写?rn如下:rn_variant_t vIndex;rnvIndex.iVal=1;rn_bstr_t bsName ;rnbsName = cmd->GetParameters ()->GetItem (&vIndex)->GetName()rn执行期异常
java 调用mysql 存储过程 输出参数乱码
java <em>调用</em><em>mysql</em> <em>存储过程</em> <em>输出</em><em>参数</em>乱码 求解决
输出参数存储过程里面能调用
rnset ANSI_NULLS ONrnset QUOTED_IDENTIFIER ONrnGOrnALTER PROCEDURE [dbo].[bf_jiaofuma_sq] rn@Fac varchar(50) output,rn@username varchar(100),rn@duanxin varchar(100),rn@ls_no varchar(50)rn ASrnbeginrndeclare @jfm intrnexec @jfm=cs_jiaofuma;1 @Fac output,@username,@duanxin,@ls_no,'123',''//执行了另一个带<em>输出</em><em>参数</em>的<em>存储过程</em>rnif(@jfm<>0)rnbeginrndeclare @cwxx varchar(50)rnselect @cwxx=dbo.[bf_fanhuicuowu](@jfm)rnraiserror(@cwxx,16,1)rnreturn(1) rnendrnelsernbeginrnupdate dbo.tcon set bf_code=@Fac where Ls_no=@ls_no//这行是重点。rnendrnendrnrn本人十分确定在这个<em>存储过程</em>体外<em>调用</em>@FactorCode 是有值得,但是rnupdate dbo.tcon set bf_code=@Fac where Ls_no=@ls_no执行后,这句bf_code却没有修改rnrn
mysql 存储过程 调用参数
写一个<em>存储过程</em>rncreate procedure test (IN test char(20))rnREAD SQL DATArnBEGINrnselect * from test.table;rnend;rn报错,说没有test.table,我想引用的是<em>参数</em>的数据库名称,但是报错,不知道<em>mysql</em>有没有这样的写法,识别<em>参数</em> test.table test是<em>参数</em>,是数据库名,table是实际的表名(有这个表table)
ADO调用存储过程参数问题
大致是这样的,我将Command<em>对象</em>及数据库连接<em>对象</em>均设置成类的成员变量,第一次<em>调用</em>带<em>参数</em>的<em>存储过程</em>没有任何问题,当我第二次执行的时候,就抛出<em>参数</em>过多的异常,我用的是Append的方式添加的<em>参数</em>,我想问的是,如果在一次<em>调用</em>后,就将Parameters中的<em>参数</em>给清空,好让我第二次<em>调用</em>的时候不会出现<em>参数</em>过多的问题!rn谢谢各位了
字符串参数存储过程,ado调用
<em>ado</em> 执行带<em>参数</em>的<em>存储过程</em>,而<em>存储过程</em><em>参数</em>是字符串的,怎么把<em>参数</em>传递进去? rnrn我的方法:rnCmd.Parameters.Append cmd.CreateParameter("@tablename",6)rnCmd("@tablename")=??? rn我直接用Cmd("@tablename")="Test_Table",提示说<em>类型</em>不匹配.rnrn这个地方怎么写? rnrn麻烦大家举个详细的例子看看.
调用如何用ADO命令对象调用有缺省参数存储过程?
<em>调用</em>如何用ADO<em>命令</em><em>对象</em><em>调用</em>有缺省<em>参数</em>的<em>存储过程</em>?该<em>存储过程</em>中的<em>参数</em>是<em>存储过程</em>中查询语句的查询条件,不同的赋值和不赋值会产生不同的查询条件限制.
mysql CAPI存储过程输出参数
请教:rn 利用<em>mysql</em><em>提供</em>的C API,执行<em>存储过程</em>,<em>存储过程</em>为:rn procDemo(in inParam int, out outParam double);rnrn 利用预处理语句rn<em>mysql</em>_stmt_prepare(stmt, procDemo(call procDemo(?,?)), strlen(PROCEDURE_SAMPLE))rnrn然后绑定<em>参数</em>rn<em>mysql</em>_stmt_bind_paramrnrn最后<em>存储过程</em>执行之后,<em>输出</em>的<em>参数</em>没有传出来,怎么办?
c#调用存储过程输出参数
<em>存储过程</em>中<em>参数</em>使用@BorrowSum int output create procedure usp_BorrowSum @ReadingCard varchar(20), @BorrowSum int output as select @BorrowSum=sum(NonReturnCount) from BorrowDetail inner join BorrowInfo on Borr
调用输出参数存储过程
由于项目在单元测试阶段,而程序<em>调用</em>的<em>存储过程</em>还没调通,我就自己在oracle写了一个临时的小存储代替: 没想到好不容易别别扭扭地编译过了,却不知道如何<em>调用</em> 我执行ALL test_proc(0,01,temp_name,msg);,报错了: 我一脸懵b…… 赶紧百度,才知道<em>输出</em><em>参数</em>要先定义才可以传值,把sql语句改为如下: 运行成功。 总结:
asp.net调用输出参数存储过程
asp.net<em>调用</em><em>输出</em><em>参数</em><em>存储过程</em> 供测试使用
输出参数存储过程调用
下面的是我的<em>存储过程</em> (我值想把<em>输出</em>值取出来) rnCREATE PROCEDURE PMaxSysNo rn @SysType as char(3), rn @D_T as datetime, --日期 rn @strSysNo as char(20) Output rnAS..... rn在查询分析器里 rn exec PmaxSysNo @SysType='aaa',@D_T='2003-11-20',@strSysNo=@strNo output rn select @strno rn 这样执行就可以了 rn rn可是在asp李我就不会了 rn我的连接数据库文件如下 rnset conn=Server.CreateObject("<em>ado</em>db.Connection") rnconn.connectiontimeout = 300 rnconn.commandtimeout = 300 rnconn.open "provider=sqloledb;data source=aa;initial catalog=bb;user id=sa;password=123;" rn rnconn.execute("PmaxSysNo @SysType='ECH',@D_T='"& D_T &"',@strSysNo='"& strSysno &"' output") 我这样执行是不对的??? rn rn
调用存储过程输出参数的问题
最近在学分页<em>存储过程</em>,在<em>调用</em>的时候出现这样的问题:未将<em>对象</em>引用设置到<em>对象</em>的实例。搞了很久都没搞清楚,所以请大家帮帮忙rn下面是代码:rnprotected void Button1_Click(object sender, EventArgs e)rn rn SqlCommand cmd = new SqlCommand("MaxTest", con);rn cmd.CommandType = CommandType.StoredProcedure;rn cmd.Parameters.Add("@PageNum", SqlDbType.Int);rn cmd.Parameters.Add("@PageSize", SqlDbType.Int);rn cmd.Parameters.Add("@countPage", SqlDbType.Int);rn cmd.Parameters["@PageSize"].Value = txtPageSize.Text;rn cmd.Parameters["@PageNum"].Value = txtPageNum.Text;rn cmd.Parameters["@countPage"].Direction = ParameterDirection.Output;rn con.Open();rn GridView1.DataSource = cmd.ExecuteReader();rn lbltotal.Text=cmd.Parameters["@countPage"].Value.ToString();rn GridView1.DataBind();rn con.Close();rn rn如果注释这句lbltotal.Text=cmd.Parameters["@countPage"].Value.ToString();rn就没问题rn这里<em>存储过程</em>rnset ANSI_NULLS ONrnset QUOTED_IDENTIFIER ONrngornALTER proc [dbo].[MaxTest]rn@PageNum int=10,rn@PageSize int=0,rn@countPage int outputrnasrndeclare @strSql nvarchar(1000)rndeclare @strto nvarchar(200)rnset @strto='select @countPage=count(*) from testTable'rnexec sp_executesql @strto,N'@countPage int out',@countPage outrnset @strSql='select top '+cast(@PageNum as varchar(20))+ ' * from testTable wherern(id>(select MAx(id) from (select top '+cast(@PageNum*@PageSize as varchar(20))+' id from TestTable order byrn id) as t))'rnexec sp_executesql @strSql
命令对象调用存储过程出错
代码:rn---------------------------------------rn rnSqlConnection nwindConn = new SqlConnection("Data Source=COMPUTER_SONG;Integrated Security=SSPI;" + "Initial Catalog=Northwind");rn nwindConn.Open();rn //string insertStr = "INSERT INTO cUSTOMERS (CustomerID,CompanyName) Values (@CustomerID,@CompanyName)";rn string insertStr = "proInsertCustomers";rn SqlCommand insertCMD = new SqlCommand(insertStr, nwindConn);rnrn SqlParameter prm1 = new SqlParameter("@CustomerID", SqlDbType.NChar, 5);rn prm1.Direction = ParameterDirection.Input;rn SqlParameter prm2 = new SqlParameter("@CompanyName", SqlDbType.NVarChar, 40);rn prm2.Direction = ParameterDirection.Input;rn insertCMD.Parameters.Add(prm1);rn insertCMD.Parameters.Add(prm2);rn prm1.Value = TextBox1.Text;rn prm2.Value = TextBox2.Text;rnrn Int32 recordsAffected = insertCMD.ExecuteNonQuery();rn Response.Write(recordsAffected.ToString() + "条记录插入");rn-----------------------------------------rn<em>存储过程</em>rnCREATE proc proInsertCustomersrn@CustomerID nchar(5),@CompanyName nvarchar(40)rnas rnInsert into Customers (CustomerID,CompanyName)Values(@CustomerID,@CompanyName)rnGOrn-----------------------------------------rn出错:rn异常详细<em>信息</em>: System.Data.SqlClient.SqlException: 第 1 行: 'proInsertCustomers' 附近有语法错误。rnrn源错误: rnrnrn行 32: prm2.Value = TextBox2.Text;rn行 33: rn行 34: Int32 recordsAffected = insertCMD.ExecuteNonQuery();rn行 35: Response.Write(recordsAffected.ToString() + "条记录插入");rn行 36: rn rnrn源文件: d:\WebSite2\Default4.aspx.cs 行: 34 rn
在ADO中调用存储过程怎样得到输出参数的值
_CommandPtr m_pCommand;rn_ParameterPtr recnum;rnm_pCommand.CreateInstance(__uuidof(Command));rnm_pCommand->ActiveConnection=theApp.m_pCon;rnm_pCommand->CommandText="testinfo";rnm_pCommand->CommandType=adCmdStoredProc;rnrnrecnum.CreateInstance(__uuidof(Parameter));rnrnrecnum=m_pCommand->CreateParameter("ccc",adInteger,adParamOutput,4);rnm_pCommand->Parameters->Append(recnum);rn rn_variant_t vNull;rn vNull.vt=VT_ERROR;rn vNull.scode=DISP_E_PARAMNOTFOUND;rntheApp.m_pRec=m_pCommand->Execute(&vNull,&vNull,adCmdStoredProc);rn_variant_t var;rnvar=recnum->value;rn这里var得到为空,请教各位怎样才能得到<em>输出</em><em>参数</em>的值
使用ADO怎样调用存储过程(带输入、输出参数)
我有一个<em>存储过程</em>定义如下(只写出<em>参数</em>情况,省略过程体)如下rnCREATE OR REPLACE PROCEDURE WFM.P_STATFEErn(rn Stat_B_Date in Date,rn Stat_E_Date in Date,rn TotalHCFee out Float,rn TotalHFFee out Float,rn TotalFHFFee out Float,rn TotalLawFee out Float,rn TotalCheckFee out Float,rn TotalMeasureFee out Floatrn)rnrn我在程序里使用ADO<em>调用</em>它,语句如下:rnwith TAdoQuery.Create(nil) dorn beginrn Tryrn Connection := AdoConn;rn Close;rn SQL.Clear;rn SQL.Add('Begin');rn SQL.Add('WFM.P_StatFee(:P_B_Date,:P_E_Date);');rn SQL.Add('End;');rn Parameters.ParamByName('P_B_Date').Value := DEFee_B_Date.Date;rn Parameters.ParamByName('P_E_Date').Value := DEFee_E_Date.Date;rn Prepared := true;rn ExecSQL;rn //EDTFW_FEE.Text := Parameters.ParamByName('TotalHCFee').Value;rn Finallyrn Close;rn Free;rn end;rn end; // withrnDEFee_B_Date.Date,DEFee_E_Date.Date都是日期框的值rn当我执行的时候,系统提示<em>参数</em>个数或<em>类型</em>错误,rn我怎样得到返回的值.谢谢!
调用 存储过程时 时参数个数或类型错误
cmd.CommandText="TWS.tws1";rncmd.CommandType= CommandType.StoredProcedure;rncmd.Connection = conn;rnrnOracleParameter tabname = new OracleParameter"tabelname",OracleType.VarChar);rntabname.Direction= ParameterDirection.Input;rntabname.Value="aaa";rnrnOracleParameter pp = new OracleParameter("IO_CURSOR",OracleType.Cursor);rnpp.Direction= ParameterDirection.Output;rnrncmd.Parameters.Add(tabname); rncmd.Parameters.Add(pp);rn rn OracleDataAdapter da = new OracleDataAdapter(cmd);rnDataSet dataset= new DataSet();rnda.Fill(dataset);rn rn未处理的异常: System.Data.OracleClient.OracleException: ORA-06550: 第 1 行, 第 7 列: rnPLS-00306: <em>调用</em> 'TWS1' 时<em>参数</em>个数或<em>类型</em>错误rnORA-06550: 第 1 行, 第 7 列: rnPL/SQL: Statement ignoredrnrnrn<em>存储过程</em>如下:rnrnPROCEDURE tws1 (tablename varchar,IO_CURSOR OUT T_CURSOR)rn ISrn V_CURSOR T_CURSOR; rn BEGINrn OPEN V_CURSOR FOR 'SELECT * FROM '||tablename; rn IO_CURSOR := V_CURSOR;rn EXCEPTION WHEN OTHERS THENrn NULL;rn END;rn rn我想是tablename变量的错误吧。 rn
是否mysql存储过程必须参数
是否<em>mysql</em>的<em>存储过程</em><em>必须</em>含<em>参数</em>rnrnrn[quote][/quote]delimiter\\rnCREATE PROCEDURE lllllrnbeginrnselect * from cp;rnend;rnrn提示错误:rn语法错误rn是否<em>mysql</em>的<em>存储过程</em><em>必须</em>含<em>参数</em>
请问如何在ADO中调用输出参数存储过程???
如题,先谢了!
ado调用存储过程为何的不到输出参数的值???
CString strSrcAddr="SP0001"rn_ariant_t vValue;rnrn_CommandPtr pCmd;rnHRESULT hr = pCmd.CreateInstance(__uuidof(Command));rn_variant_t vValue; rntryrnrn //创建<em>存储过程</em>rn pCmd->PutCommandText("GetEnterprisePsw");rn pCmd->ActiveConnection = m_pConnection;rn pCmd->Parameters->Append(pCmd->CreateParameter rn ("EnterpriseID",adChar,adParamInput,6,_bstr_t(strSrcAddr)));rn pCmd->Parameters->Append(pCmd->CreateParameter rn ("Authenticator",adChar,adParamOutput,16,vValue));rn pCmd->Execute(NULL,NULL,adCmdStoredProc);rnrncatch(_Com_error &e)rn...rn<em>输出</em><em>参数</em>vValue总是ET_EMPTY,<em>存储过程</em>本身没有问题,在SQLSERVER中完全执行正确rn谢谢大家!!!rn
调用存储过程参数问题
这个方法在<em>调用</em>是如果<em>调用</em>的是没有输入<em>参数</em>或一个<em>参数</em>时是可以的,但是如果是两个及以上就出现错误,求解释啊!rnrn这个是<em>存储过程</em>rn[code=sql]rnUSE [restaurantSys]rnGOrn/****** <em>对象</em>: StoredProcedure [dbo].[createorder] 脚本日期: 12/06/2012 13:54:48 ******/rnSET ANSI_NULLS ONrnGOrnSET QUOTED_IDENTIFIER ONrnGOrnALTER proc [dbo].[createorder]rn(@table varchar(20),@AmountofCustomer int)rnasrnbeginrn declare @error intrn set @error=0rn begin tranrn insert into dbo.[Order](OrderID,OrderTime,TableID,AmountofCustomer,CheckStatus) values(dbo.getOrderID( ),getdate(),@table,@AmountofCustomer,2)rn set @error=@@error+@errorrn update dbo.[table] set table_status=2 where table_id=@tablern set @error=@@error+@errorrn if (@error=0)rn beginrn print '成功'rn commit tranrn endrn elsern beginrn print '失败'rn rollback tranrn endrnend[/code]rnrn这个方法在<em>调用</em>是如果<em>调用</em>的是没有输入<em>参数</em>或一个<em>参数</em>时是可以的,但是如果是两个及以上就出现错误,求解释啊!rnrn这个是DBHelper里<em>调用</em><em>存储过程</em>方法ExecuteProcedure()rn[code=csharp] rn public static int ExecuteProcedure(string proName, params SqlParameter[] values)//<em>调用</em><em>存储过程</em>rn rn tryrn rn SqlCommand cmd = new SqlCommand(proName, Connection);rn cmd.CommandType = CommandType.StoredProcedure;rn cmd.Parameters.Add(values);rn int result = cmd.ExecuteNonQuery();rn return result;rn rn catch (Exception ex)rn rn throw ex;rn rn finallyrn rn connection.Close();rn rn [/code]rnrn这个方法在<em>调用</em>是如果<em>调用</em>的是没有输入<em>参数</em>或一个<em>参数</em>时是可以的,但是如果是两个及以上就出现错误,求解释啊!rnrn这个是数据访问层(DAL)<em>调用</em><em>存储过程</em>DBHelper里的方法ExecuteProcedure()rn[code=csharp] rnpublic static void AddOrder( string table_id,int AmountofCustomer)//该方法向order添加一个桌子rn rn SqlParameter("@AmountofCustomer",AmountofCustomer);rn SqlParameter[] para = new SqlParameter[2];rn para[0] = new SqlParameter("@table", table_id);rn para[1] = new SqlParameter("@AmountofCustomer", AmountofCustomer);rn DBHelper.ExecuteProcedure("createorder", para);rn[/code]
存储过程二进制参数的指定
我打算把一些比较小的文件(50-100KB)的文件序列化成字节数组后放到数据库中。rnrn我这边的插入操作都是用的<em>存储过程</em>,在写传递<em>参数</em>的时候,遇到一个问题。DbType.Binary最大只能支持到8KB的。rnrn超出8KB的文件我该怎么放呢?
关于 asp.net调用存储过程 参数长度问题
cmd.Parameters.Add("@CommunityStr", SqlDbType.NVarChar, [color=#FF0000]30[/color]);rnrn这里的 30 是不是指 <em>参数</em>的<em>长度</em> rnrn比如说<em>存储过程</em>里的 的<em>参数</em>为 @CommunityStr nvarchar(30)rnrn但是我明明是在 30 个字符以内的 还出现了错误 rnrn[color=#FF0000]异常详细<em>信息</em>: System.Data.SqlClient.SqlException: 将截断字符串或<em>二进制</em>数据。[/color]rnrn
类型长度大于最大值(Java调用存储过程)
<em>类型</em><em>长度</em>大于最大值(Java<em>调用</em><em>存储过程</em>)
怎么调用存储过程的ref cursor类型输出参数返回的内容
有<em>存储过程</em>如下rncreate or replace package pck_test isrn type out_cur is ref cursor;rnrnrncreate or replace procedure prc_test(rncur out pck_test.out_cur;rn)rnisrnbeginrn open cur rn for select 1 from dual;rnend;rn请问,我在oracle中怎么能够得到这个<em>输出</em><em>参数</em>cur的内容呢?rn
C++MFC使用ADO调用mysql带参存储过程参数中文乱码
服务器gbkrn数据库gbkrn表gbkrnrn<em>调用</em><em>存储过程</em>准备:rn//创建连接<em>对象</em>实例rnm_pConnection.CreateInstance("ADODB.Connection");rnCString strConnect="..." rn//使用Open方法连接数据库rnm_pConnection->Open((_bstr_t)strConnect,"","",adModeUnknown);rnrn_CommandPtr m_pCommand;//初始化<em>命令</em><em>对象</em>rnm_pCommand.CreateInstance("ADODB.Command");//创建<em>命令</em>实例rnm_pCommand->ActiveConnection=m_pConnection;//设置<em>命令</em><em>对象</em>的连接rnm_pCommand->CommandText = _bstr_t("evaluate_count9");//<em>存储过程</em>名rnm_pCommand->CommandType=adCmdStoredProc;//rnm_pCommand->Parameters->Refresh();rnrn//<em>参数</em>值rn_variant_t vvar1,vvar2,vvar3;rnvvar1=_variant_t(_bstr_t(m_CountDepartment));rnvvar2=_variant_t(_bstr_t(m_DateBegin));rnvvar3=_variant_t(_bstr_t(m_DateEnd));rn//注意以上参 m_CountDepartment 为CString<em>类型</em>变量 值为:"/北京" 。。。。rnrn_ParameterPtr ParametV;rnParametV.CreateInstance(__uuidof(Parameter));rnrn//添加到集合rn ParametV=m_pCommand->CreateParameter(_bstr_t("DepartmentName2"),adVarChar,adParamInput,32,vvar1);rn m_pCommand->Parameters->Append(ParametV);rnrn ParametV=m_pCommand->CreateParameter(_bstr_t("STARTDealDateTime"),adVarChar,adParamInput,32,vvar2);rn m_pCommand->Parameters->Append(ParametV);rn rn ParametV=m_pCommand->CreateParameter(_bstr_t("endDealDateTime"),adVarChar,adParamInput,32,vvar3);rn m_pCommand->Parameters->Append(ParametV);rnvvar3=_variant_t(_bstr_t(m_DateEnd));rnrn//执行<em>存储过程</em>rnm_pRecordset = m_pCommand->Execute(&vNull,&vNull,adCmdStoredProc);rnrn
存储过程参数长度
求解 怎求传进<em>参数</em>的数据的<em>长度</em> rn @CSWSC --<em>参数</em>rn len(@CSWSC) 不是传进数据的<em>长度</em>rn
ado访问MySQL的带OUT参数存储过程时出错!
出错提示<em>信息</em>为:OUT or INOUT argument 1 for routine test.ProcTest2 is not a variable or NEW pseudo-variable in BEFORE triggerrn查了资料,貌似是MySQL的bug,是这样的吗?rnrn////////////////////////////////////rn// 相关代码如下rntryrnrnHRESULT hResult;rnhResult = m_pDBConn.CreateInstance(__uuidof(Connection));rnm_pDBConn->CursorLocation = adUseClient;rnTCHAR szOut[MAX_PATH];rnsprintf( szOut, "DSN=%s;UID=root;PWD=123;", "zdMySQL" );rnhResult = m_pDBConn->Open( _bstr_t(szOut), _bstr_t(""), _bstr_t(""), adModeUnknown );rnrn_CommandPtr pCmd;rnhResult = pCmd.CreateInstance( __uuidof( Command ) );rn_ParameterPtr pOutParamUserID = pCmd->CreateParameter( "nOutDataUserID", adInteger, adParamOutput, 4, 0 );rnpCmd->Parameters->Append( pOutParamUserID );rnpCmd->CommandText = "ProcTest2";rnpCmd->CommandType = adCmdStoredProc;rnpCmd->Prepared = VARIANT_TRUE;rnpCmd->ActiveConnection = m_pDBConn;rn_RecordsetPtr pRecordSet;rnrnpRecordSet = pCmd->Execute( NULL, NULL, adOptionUnspecified );rnif( pRecordSet )rnrnwhile( !pRecordSet->EndOfFile )rnrnchar szUserName[32];rn_snprintf( (char*)szUserName, 32 , _bstr_t( pRecordSet->Fields->Item["UserName"]->Value.bstrVal ) );rnint n = 0;rnrnrn rncatch(_com_error e)rnrnTCHAR szOut[MAX_PATH];rnsprintf( szOut, "[ERROR][COM]: \n[0x%08X][%d][%s]\n[%s]\n%s\n",rne.Error(), e.Error(), e.ErrorMessage(), (TCHAR*)e.Source(), (TCHAR*)e.Description());rnrnrn///////////////////////////////////////////////////////////rn// ProcTest2是这样创建的rncreate procdure ProcTest2(OUT nOutDataUserID INT)rnBEGINrn select UserName from users where UserID=1;rn set nOutDataUserID = 1;rnENDrn
救命?ADO调用存储过程的不到输出值?
int row = 0;rn _variant_t varRow;rn _ParameterPtr mp_Row;rn CString strerror;rn varRow.vt = VT_I2;rn varRow.iVal = row;rn _bstr_t strUpdateSql1 = L"sp_test";rn pApp->m_pCommand->ActiveConnection = pApp->m_pConnection;rn pApp->m_pCommand->CommandText = strUpdateSql1;rn pApp->m_pCommand->CommandType = adCmdStoredProc;rn pApp->m_pCommand->CommandTimeout = 3600;rn// varRow.intVal = _variant_t(row);rn mp_Row.CreateInstance(__uuidof(Parameter));rn mp_Row = pApp->m_pCommand->CreateParameter(_bstr_t("var1"),adInteger,adParamOutput,sizeof(int),varRow);rn pApp->m_pCommand->Parameters->Append(mp_Row);rn _variant_t vNull; rn vNull.vt=VT_ERROR; rn vNull.scode=DISP_E_PARAMNOTFOUND;rn if(pApp->m_pCommand->Execute(&vNull,&vNull,adCmdStoredProc))rn rn _variant_t temp =pApp->m_pCommand->Parameters->GetItem("var1")->Value;rnrn row = temp.iVal;rn CString strTest;rn strTest.Format("%d",row);rn AfxMessageBox(strTest);rn rnrn这是<em>调用</em>ADO的代码,但是得不到<em>输出</em>的值,row的值是初值0?rn请高手帮忙!
使用ADO控件能调用参数存储过程吗?
使用ADO控件能<em>调用</em>含<em>参数</em>的<em>存储过程</em>吗?如果能怎样使用,请赐教一段实例代码不胜感激!!!
如何用命令查找存储过程参数类型
如何通过<em>存储过程</em>名查找它的<em>参数</em>和<em>类型</em>,在orcale中rn
用MFC/ADO调用存储过程时遇到NTEXT类型处理问题
我的<em>存储过程</em>的其中一个<em>参数</em>是用NTEXT作为传入<em>参数</em>,但是在ADO中找不到对应的数据<em>类型</em>,如下代码:rnm_pParam1 = m_pCmd->CreateParameter("@XMLData",adBSTR,adParamInput,255,cBody);rn以上代码中的adBSTR是表示<em>存储过程</em><em>参数</em>的,该<em>参数</em>的<em>长度</em>最大可能是几万个字符,因此用VARCHAR<em>类型</em>肯定是不行的,我就用了NTEXT<em>类型</em>。rn现在在ADO中不知道该用哪种<em>类型</em>来对应。以下是ADO参考中所列出来的所有<em>类型</em>,请有经验者帮我一下。rnAdArray rnadBigIntrnadBinaryrnadBoolean rnadBSTR rnadChapter rnadChar rnadDate rnadDBDate rnadDBTime rnadDBTimeStamp rnadDecimal rnadDouble rnadEmpty rnadError rnadFileTime rnadGUID .rn rnadInteger rnadIUnknown rnadLongVarBinary rnadLongVarChar rnadLongVarWChar rnadNumeric rnadPropVariant rnadSingle rnadSmallInt rnadTinyInt rnadUnsignedBigInt rnadUnsignedInt rnadUnsignedSmallInt rnadUnsignedTinyInt rnadUserDefined rnadVarBinary rnadVarChar rnadVariant rnadVarNumeric rnadVarWChar rnadWChar rn
ASP 调用存储过程 但未提供参数
提示错误rnrn'MS_Inventory'需要<em>参数</em> '@User_action',但未<em>提供</em>该<em>参数</em>。rnrnrnASP<em>调用</em>rn DIM MyComm : Set MyComm = Server.CreateObject("ADODB.Command") rn with MyComm rn .ActiveConnection = Conn rn .CommandText = "MS_Inventory" rn .CommandType = 4 rn .Prepared = true rn .Parameters.append MyComm.CreateParameter("RETURN",2,4)rn .Parameters.append MyComm.CreateParameter("@User_action",2,1,4,1)rn .Execute rn end withrnrnrn<em>存储过程</em>rnCREATE PROCEDURE [Dbo].[MS_Inventory]rn(rn@User_action int outputrn)rnASrnset nocount onrn if @User_action=1rn BEGINrn return 1rn ENDrn elsern BEGINrn return 10rn ENDrnrnGOrnrnrn新手,帮忙看看,如果可以的话,帮忙解释下为什么,谢谢哈rn
ADO,调用存储过程怎么设参数?(急!)
我写了以下代码,但是就是执行时出错?想不明白为什么。rnrn m_command = NULL;rn rn m_command.CreateInstance("ADODB.COMMAND");rn m_command->ActiveConnection = m_connection;rn m_command->CommandType = adCmdStoredProc;rn m_command->CommandText = "dbo.PrvQInsertQuestionSet"; rn //<em>存储过程</em>接口rn //dbo.PrvQInsertQuestionSet(@topicname char(50), @topictype smallint, @ret bigint output)rnrn rn rn _ParameterPtr paramTopicname;rn paramTopicname.CreateInstance("ADODB.Parameter");rn paramTopicname->Name = "@topicname";rn paramTopicname->Direction = adParamInput;rn paramTopicname->Type = adChar;rn paramTopicname->Size = qsname.length();rn paramTopicname->Value = _variant_t(qsname.c_str());rn m_command->Parameters->Append(paramTopicname);rnrn rn _variant_t tempType;rn tempType.intVal = type;rnrn _ParameterPtr paramTopictype;rn paramTopictype.CreateInstance("ADODB.Parameter");rn paramTopictype->Name = "@topictype";rn paramTopictype->Direction = adParamInput;rn paramTopictype->Type = adSmallInt;rn paramTopictype->Size = 2;rn paramTopictype->Value = tempType;rn m_command->Parameters->Append(paramTopictype);rnrn rn _ParameterPtr paramRet;rn paramRet.CreateInstance("ADODB.Parameter");rn paramRet->Name = "@ret";rn paramRet->Direction = adParamOutput;rn paramRet->Type = adBigInt;rn paramRet->Size = 8;rn m_command->Parameters->Append(paramRet);rn rn rn rn m_command->Execute(NULL, NULL, adCmdStoredProc);
ado调用参数存储过程,help
"Procedure 'dt_query_arrive' expects parameter '@Start', which was not supplied." (1)rnrn代码rn oletimefrom.SetDateTime(1990,1,1,hf,0,0);rn oletimeto.SetDateTime(1990,1,1,ht,0,0);rn vtStation1.vt=VT_BSTR;rn vtStation1.bstrVal=strQ.AllocSysString( );rn vtStation2.vt=VT_BSTR;rn vtStation2.bstrVal=strZ.AllocSysString ( );rn vtFrom.vt=VT_DATE;rn vtFrom.date=oletimeto;rn vtTo.vt=VT_DATE;rn vtTo.date=oletimefrom;rnrnpCommand->CommandText = "dt_query_arrive";rn pCommand->CommandType = adCmdStoredProc;rn pPrmStation1 = pCommand->CreateParameter((_bstr_t)"station1",adBSTR,adParamInput,strQ.GetLength(),vtStation1);rn pCommand->Parameters->Append(pPrmStation1);rn pPrmStation1->Value=vtStation1;rn pPrmStation2= pCommand->CreateParameter((_bstr_t)"station2",adBSTR,adParamInput,strQ.GetLength(),vtStation2);rn pCommand->Parameters->Append(pPrmStation2);rn pPrmStation2->Value=vtStation2;rn pPrmFrom = pCommand->CreateParameter((_bstr_t)"from",adDate,adParamInput,strQ.GetLength(),vtFrom);rn pCommand->Parameters->Append(pPrmFrom);rn pPrmFrom->Value=vtFrom;rn pPrmTo= pCommand->CreateParameter((_bstr_t)"to",adDate,adParamInput,strQ.GetLength(),vtTo);rn pCommand->Parameters->Append(pPrmTo);rn pPrmFrom->Value=vtTo;rn pCommand->Parameters->Refresh();rn pRecordset = pCommand->Execute(NULL,NULL,adCmdStoredProc); rnrn<em>存储过程</em>如下rnCREATE PROCEDURE dt_query_arrivern @Start varchar(20),rn @End varchar(20) ,rn @Time_start datetime,rn @Time_end datetimernAS rnSELECT Q.Train_idrnFROM RoutineRecord Q,RoutineRecord WrnWHERE Q.Station_name=@StartrnAND Q.Train_id=W.Train_idrnAND W.Station_name=@EndrnAND W.Seq>Q.SeqrnAND W.Arrive_time BETWEEN @Time_Start AND @Time_endrnrnrnrnrn
ADO调用存储过程如何指定参数
我用了下面的代码来<em>调用</em>一个<em>存储过程</em>rngen_menu(@uno Integer, @level Integer, @lastselect varchar(50))rn在运行时总是抛出异常“至少一个<em>参数</em>没有被指定值”,怎么办啊?rn下面是测试的<em>存储过程</em>和ADO代码rnrnCREATE PROCEDURE gen_menu(rn@uno Integer,@level Integer,@lastselect varchar(50)rn) ASrnselect * from testrnrnGOrnrn_RecordsetPtr rs(__uuidof(Recordset));rnrs.CreateInstance(__uuidof(Recordset));//初始化Recordset指针rnBOOL ret=TRUE;rnlong cnt=0;rntryrn //--------------------------------------------------------rn m_pcommand->PutCommandText(L"call gen_menu(?,?,?)");rn m_pcommand->PutCommandType(adCmdStoredProc);rn m_pcommand->PutCommandTimeout(1000);rn _ParameterPtr paramptr;rn paramptr = m_pcommand->CreateParameter(_bstr_t("uno"),adInteger,adParamInput,sizeof(long), (long)uno);rn m_pcommand->GetParameters()->Append(paramptr);rn paramptr = m_pcommand->CreateParameter(_bstr_t("level"),adInteger,adParamInput,sizeof(long), (long)level);rn m_pcommand->GetParameters()->Append(paramptr);rn paramptr = m_pcommand->CreateParameter(_bstr_t("lastselect"),adVarChar,adParamInput,lastselect.GetLength()+1, _variant_t(lastselect));rn m_pcommand->GetParameters()->Append(paramptr);rn rs->Open((_Command*)m_pcommand,vtMissing,adOpenForwardOnly,adLockOptimistic,adCmdStoredProc);rn rs->Fields->get_Count(&cnt);rn if(cnt!=1) ret=FALSE;rn elsern v.clear();rn while(!rs->Get_EOF())rn string =(LPCTSTR)_bstr_t(rs->GetCollect(L"prop_value"));rn v.push_back(s);rn rn rn //--------------------------------------------------------rnrncatch(_com_error& e)rn ErrorsPtr pErrors=m_pconnection->GetErrors();rn if(pErrors->GetCount()==0)rn rn AfxMessageBox(e.ErrorMessage());rn rn elsern rn for(int i=0;iGetCount();i++)rn rn _bstr_t esc=pErrors->GetItem((long)i)->GetDescription();rn AfxMessageBox(desc);rn rn rnrncatch(...)rnrn AfxMessageBox("some exception occured");rnrnrs->Close();rnreturn ret;rn
调用输出参数ADO的内存泄露问题
BOOL DBModeDeal::Get_BSRINFO(NSRINFO* m2nsrinfo)rn //<em>调用</em><em>存储过程</em>//1217等待填充和修改rn rn _ParameterPtr para[3]; rn _CommandPtr pCmd; rn _bstr_t storeproc("p_getNsrjbxxFromMk2ToWsbs");//p_getNsrjbxxFromMk2ToWsbsrn _variant_t var,var1;rn int index = 0;rn tryrn rn pCmd.CreateInstance(__uuidof(Command)); rn para[0].CreateInstance("ADODB.Parameter"); rn para[1].CreateInstance("ADODB.Parameter"); rn para[2].CreateInstance("ADODB.Parameter"); rn rn pCmd->ActiveConnection=m_M2pConn; rn pCmd->CommandText=storeproc; rnrn SetPara(para[0],pCmd,"YHSBH1",m2nsrinfo->sNSRSBH,adBSTR,adParamInput,100,var);//纳税人识别号rn rn SetPara(para[1],pCmd,"SWJG_DM1","",adVarChar,adParamOutput,100,var);//字符串型<em>输出</em><em>参数</em>,结果rn rn SetPara(para[2],pCmd,"YHMC1","",adVarChar,adParamOutput,300,var1);//字符串型<em>输出</em><em>参数</em>,名称rn rn rn pCmd->Execute( NULL, NULL, adCmdStoredProc); rn var=pCmd->Parameters->GetItem("SWJG_DM1")->GetValue();//通过<em>参数</em>返回值 rn m2nsrinfo->sSWJG_DM = GetVaule(var);rnrn var1=pCmd->Parameters->GetItem("YHMC1")->GetValue();//通过<em>参数</em>返回值 rn m2nsrinfo->sYHMC = GetVaule(var1);rnrn pCmd.Detach(); rn return TRUE;rn rn catch (_com_error e) rn const TCHAR* pError=e.ErrorMessage();rn // AfxMessageBox(pError);rn return FALSE;rn rn return TRUE;rnrnrnrn其中rnvoid DBModeDeal::SetPara(_ParameterPtr para,_CommandPtr pCmd, CString NodeName,CString NodeValue,DataTypeEnum ParaType,ParameterDirectionEnum ParaIoType,int CharLen,_variant_t var)rnrn int index=0;rn if (ParaIoType == adParamInput)//输入<em>参数</em>rn rn para=pCmd->CreateParameter(_bstr_t(NodeName), ParaType,ParaIoType, rn sizeof(NodeValue),_variant_t(NodeValue)); //字符串型输入<em>参数</em>,rn pCmd->Parameters->Append(para); rnrn rn if (ParaIoType == adParamOutput)//<em>输出</em><em>参数</em>rn rn var.Clear();rn var = (short)index;rn para=pCmd->CreateParameter(_bstr_t(NodeName), ParaType,ParaIoType, rn sizeof(char[50]),var); //字符串型<em>输出</em><em>参数</em>,错误<em>信息</em>rn pCmd->Parameters->Append(para); rn rnrn为何<em>调用</em>完成后内存增长却不降低呢,程序长时间运行后虚拟内存就增长的比较大,大虾救我。
ado访问时,存储过程命令错误!!!
我用ADO访问SQL数据库运行<em>存储过程</em><em>命令</em>rn在开发的时候XP+VC6.0没有任何问题rn但我把程序拷到一台2000SERVER机子运行的时候,一到运行<em>存储过程</em>就出错rn其他访问数据库都正常!rn非常郁闷,是不是有什么数据环境要设置啊rn谢谢
ADO:CommandPtr对象调用oracle中的存储过程
一、<em>调用</em><em>存储过程</em>的步骤: 1、生成并初始化一个_CommandPtr<em>对象</em>;  2、生成<em>调用</em><em>存储过程</em>需要的<em>参数</em>,这些<em>参数</em>都是_ParameterPtr<em>对象</em>;         3、按照顺序使用_CommandPtr的Append方法为<em>存储过程</em><em>提供</em><em>参数</em>(包括输入<em>参数</em>和<em>输出</em><em>参数</em>);        4、为_CommandPtr<em>对象</em>指定需要使用的ADO连接;      5、使用_CommandPtr的Exec...
程序中怎样调用mySql的存储过程并取得输出参数?????????????
OdbcConnection conn = new OdbcConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]);rn conn.Open();rn OdbcCommand comm = conn.CreateCommand();rn string sql = "call sp_myPro(@a)";rn comm.CommandText = sql;rn comm.CommandType = CommandType.StoredProcedure;rn OdbcParameter para = new OdbcParameter("@a", OdbcType.Int, 11);rn para.Direction = ParameterDirection.Output;rn comm.Parameters.Add(para);rn comm.ExecuteNonQuery();rn conn.Close();rnrn string result = para.Value.ToString(); rnrn<em>存储过程</em>rnCREATE PROCEDURE `sp_myPro`(OUT param1 INTEGER(11))rn NOT DETERMINISTICrn SQL SECURITY DEFINERrn COMMENT ''rnBEGINrn select count(id) into param1 from test;rnEND;rnrn我<em>调用</em>时不会报错,但<em>输出</em><em>参数</em>的值一直是空的,不知这是什么原因,我因该怎么做,rnmySql的的<em>存储过程</em>和msSql有什么区别啊,大家帮一下帮。rn
调用存储过程时出错: 必须说明标识符
在工具PL/SQL DEVELOPER中,包及包体都编译成功了,但c#<em>调用</em>时总出错,提示:rnPLS-00201: <em>必须</em>说明标识符 '......'rnORA-06550: 第 1 行, 第 7 列: rnPL/SQL: Statement ignored
php调用mysql 存储过程得不到输出参数的值
<em>mysql</em>的版本:5.0.18rn我在php中<em>调用</em><em>mysql</em><em>存储过程</em>得不到返回值,代码如下:请各位看看究竟问题出在什么地方:?rnrnrnecho "<em>存储过程</em>测试: ";rnrn <em>mysql</em>_query("set @a");rn$result=<em>mysql</em>_query("calltest.amount(@a)");rn$result=<em>mysql</em>_query("select @a");rnlist($row)=<em>mysql</em>_fetch_row($result);rn echo "The amount of student is:".$row;rnrn<em>存储过程</em>没有问题,定义如下:rncreate procedure amount(out num int)rnbeginrnselect count(*) from student;rnend;rnrn我<em>输出</em>了$result的值,是:Resource id #3,请问这是怎么回事?rn
java调用mysql输出参数存储过程问题
[size=medium]在java<em>调用</em><em>mysql</em>的<em>存储过程</em>时 当报以下错误的时候java.sql.SQLException: Parameter number X is not an OUT parameter 如果你确定第X个<em>参数</em>是<em>输出</em><em>参数</em> 问题有可能是因为建<em>存储过程</em>的时候 <em>输出</em><em>参数</em>写了备注。。。就会引起这个异常(耗了大半天才发现这错误) 错误写法如下[/size][code=&quot;...
MYSQL中如何调用输出参数存储过程
MYSQL中如何<em>调用</em>带<em>输出</em><em>参数</em>的<em>存储过程</em> 不同于带入参的过程,<em>参数</em>不能常量输入,可以(随便)放一个<em>用户</em>变量@outp<em>调用</em>过程,执行完毕后再(就像使用函数那样)查看该变量值就可以了。 <em>mysql</em>&amp;amp;gt; create procedure add_id(out count int) -&amp;amp;gt; begin -&amp;amp;gt; declare itmp int; -&amp;amp;gt; declar...
请问怎样用ADO原生对象调用存储过程
谢谢
C调用mysql 存储过程的问题
各位好:rn 在linux的C程序中,用<em>mysql</em><em>提供</em>的API去<em>调用</em><em>存储过程</em>:rnchar sqlstr[50] = "call LCT_get_func('2001')";rn<em>mysql</em>_real_query(handle,sqlstr,strlen(sqlstr))rnrn<em>存储过程</em>是:rnCREATE DEFINER=`root`@`%` PROCEDURE `LCT_get_func`(IN i_linknum VARCHAR(31))rnBEGIN rnSELECT id,function FROM user_info WHERE phone_num=i_linknum;rnEND;rnrn里面的的select语句,如果查询单个字段(比如:SELECT function FROM user_info WHERE phone_num=i_linknum;)没有任何问题,但是select多个字段时(比如:SELECT id,function FROM user_info WHERE phone_num=i_linknum;),整个程序就会崩溃,也不报错,rn请问这是怎么回事?rn<em>mysql</em>服务器的版本是5.5
C语言调用mysql存储过程
有一张sc表,保存学生选课记录,有课程号,学号,平时分,卷面分,总分,建立过程如下 create class( cno varchar(8) not null, sno varchar(8) not null, ordinary_score int, last_score int, all_score int );<em>存储过程</em> 由括号包围的<em>参数</em>列<em>必须</em>总是存在。如果没有<em>参数</em>,也该使用一个空
dll的参数可以是ADO对象吗?
这样GetList(dbconn:TADOConnection,dbquery:TADOQuery,sql:string)可以吗?rnrn如果不行,则如何解决我在DLL中要连接查询数据库,并返回结果啊?
问一下mysql存储过程输出参数的问题
同样一个<em>存储过程</em> 例如:rn[code=SQL]CREATE PROCEDURE `test`(IN userid int,OUT l int)rnbeginrn set l = 5;rnendrn[/code]rn然后我在触发器里 去<em>调用</em>这个<em>存储过程</em> 如下:rn[code=SQL]rncreate trigger setlevel before update on uchome_spacernFOR EACH ROW rnbeginrn declare le int default 0;rn if old.experience <> new.experience then rn call test(new.uid,@le);rn set new.level = le;rn end if;rnendrn[/code]rn但是触发器每次触发的时候 总是得到的le是0 ,如果去掉前面的@就会得到正确的值,我的问题是这个@在什么情况下用,什么时候不用吗?我在网上查了下,没有查到满意的答案,或许是我没有表达清楚。rn各路英雄 如有知道者,望能不吝赐教。
调用存储过程时如何同时取到返回的结果集和输出参数
<em>调用</em>一个<em>存储过程</em>,返回结果集和<em>输出</em><em>参数</em> @TotalCount int output rn我在查询分析器内<em>调用</em>正常能返回结果集和<em>输出</em><em>参数</em>rn但我在ASP里<em>调用</em>时遇到一个问题:rnSet cmd = Server.CreateObject("ADODB.Command") rnwith cmdrn.ActiveConnection = connrn.CommandType = 4 '---声明此过程为<em>存储过程</em>rn.CommandText = "pagination3"rnrn.Parameters.Append .CreateParameter("@tblName",adVarChar,1,50,m_tableNme)rn.Parameters.Append .CreateParameter("@GetFields",adVarChar,1,200,GetFields)rn......rn.Parameters.Append .CreateParameter("@strWhere",adVarChar, adParaminput, 500, null)rn.Parameters.Append .CreateParameter("@TotalCount", adInteger, adParamOutput, 16, TotalCount)rnend withrnrnset rs1 = cmd.Execute '如果这句改成 cmd.Execute 那可以取到<em>输出</em><em>参数</em>rnrnTotalCount = cmd.Parameters("@TotalCount").Value rnresponse.write TotalCountrndo while not rs1.EOF rn response.write rs1("g_id")rn rn rs1.MoveNextrnlooprnrs1.Closernset rs1 = nothing rnrn我这样<em>调用</em><em>存储过程</em>,可以取出结果集,但无法取到<em>输出</em><em>参数</em>@TotalCountrn如果把set rs1 = cmd.Execute 这句改成 cmd.Execute 那可以取到<em>输出</em><em>参数</em>但这样无法就没结果集了rn不知道我的<em>调用</em>有什么错误吗?应该怎么做能同时取到返回的结果集和<em>输出</em><em>参数</em>rn请指教!
.Net调用输出参数存储过程
public static void Query(string sql, string name, out string realName) { string connectionString = &quot;data source=(local);uid=sa;pwd=1;initial catalog=ypth&quot;; using (SqlCo...
VB调用输出参数存储过程的问题
Private Sub Command1_Click()rnDim rprice As CurrencyrnDim StrRoomtype As StringrnIf cnn.State Thenrncnn.ClosernEnd IfrnCall mainrnrnIf Not Adodc1.Recordset.EOF ThenrnStrRoomtype = Adodc1.Recordset.Fields("rtype").ValuernEnd Ifrnrncmm.CommandText = "selroom"rncmm.CommandType = adCmdStoredProcrnSet cmm.ActiveConnection = cnnrncmm.Parameters.Append cmm.CreateParameter("@roomtype", adVarChar, adParamInput, 2, StrRoomtype)rncmm.Parameters.Append cmm.CreateParameter("@roomprice", adCurrency, adParamOutput)rnSet rs = cmm.Executernrprice = cmm.Parameters("roomprice").ValuernText1.Text = Str$(rprice)rnLabel2.Caption = "现有空房:" & Str$(rs.RecordCount) & "间"rnrnEnd SubrnrnrnPublic cnn As New ADODB.ConnectionrnPublic cmm As New ADODB.CommandrnPublic rs As New ADODB.RecordsetrnPublic strcnn As StringrnrnPublic Sub main()rnstrcnn = "Provider=sqloledb;Data Source=(local);Initial Catalog=hotel;Integrated Security=SSPI"rncnn.Open (strcnn)rnrnEnd Subrnrnrnrn报错:在对应所需名称或序数集合中,未找到该项目rnrn还有带一个问题,如次执行后应该要清空传入<em>参数</em>,应该怎样清空
存储过程 输出参数在asp调用的问题。
CREATE PROCEDURE s_timeloginrn@username char(10),rn@ifover int output,rn@etime datetime outputrn ASrnupdate usertable set s_time=getdate(),e_time=dateadd(n,45,getdate()) where username=@usernamernselect @etime=(select e_time from usertable where username=@username)rnselect s_time,e_time,username from usertable where username=@usernamernif @etime>getdate()rnset @ifover='1'rnelsernset @ifover='0'rnGOrnrnrnrn<em>调用</em><em>存储过程</em>rnrnset Comm=server.CreateObject("Adodb.Command")rnComm.ActiveConnection=connrnComm.CommandText="s_timelogin" rnComm.CommandType=4 rnSet p1=Comm.CreateParameter("@username",200,1,50,session("username")) rnComm.Parameters.Append p1 rnrnSet p2=Comm.CreateParameter("@ifover",2,2) rnComm.Parameters.Append p2 rnrnSet p3=Comm.CreateParameter("@etime",135,2) rnComm.Parameters.Append p3 rnrnrnrnset rs=Comm.Execute rnresponse.write "开始时间"&rs("s_time")&"------结束时间"&rs("e_time")rn//为什么不能用rs("ifover")rn//if comm("@ifover")=1 thenrn//response.write "asdf"rn//elsern//response.write "aaa"rn//end ifrns_time=rs("s_time")rnrne_time=rs("e_time")
ibatis调用存储过程,参数未out类型时的典型错误
在一个Java WEB 项目中利用iBATIS<em>调用</em>一个ORACLE的<em>存储过程</em>。其中一个varchar2<em>类型</em>in<em>参数</em>,三个number<em>类型</em>的out<em>参数</em>。在iBATIS配置文件中则定义 varchar2 <em>参数</em>的定义为 [code=&quot;java&quot;]jdbcType=”VARCHAR” javaType=”java.lang.String” mode=”IN”,[/code] 而number<em>类型</em>的参...
PLS-306: 调用 '存储过程名' 时参数个数或类型错误
[code=SQL]rnCREATE OR REPLACE PROCEDURE SYNCOperatorFromTELANT(p_operation NUMBER,--操作<em>类型</em> 1 删除 2 修改 3 新增rn p_name VARCHAR2,--登录名称,要唯一rn p_password varchar2,--密码rn p_fullName Varchar2 Default Null,--<em>用户</em>名称rn p_des Varchar2 Default Null,--描述rn p_domain VARCHAR2,--本地网rn p_contact Varchar2 Default Null) AS--联系方式rn /* v_id NUMBER;*/rn v_domainid NUMBER;rn /*v_querySql VARCHAR2(1000);*/rnrn CURSOR cur_domain ISrn select r.id from gisdomain r where r.domain_ = '''||p_domain||''';rnrnBEGINrn。。。。。。rn[/code]rn我的函数是:rn[code=Java]XX.executeSP("SYNCOperatorFromTELANT",new Object[]this.p_operation,p_name,p_password,p_fullName,p_des,p_domain,p_contact);rn[/code]rn这里的executeSP(存过名,Object[])rn测试例:2、testok、TVRJek5EVTINCg==、测试T、【空值】、NA、【空值】
Java代码调用数据库带输出参数存储过程
<em>存储过程</em>: create or replace procedure p_generate_processintanceid(v_rule     in number,                                                         v_result   out varchar2) is   v_seq        number; begin
如何调用输出参数存储过程
我用的是网上找到的一个CMyDatabase和CMyRecordset实现的,他们分别继承了CDatabase和CRecordsetrn类。rn一般<em>调用</em>如下rnm_db.OpenEx(strConnect,CDatabase::noOdbcDialog);rnCMyRecordset m_Recordset(&m_db);rnbRtn = m_Recordset.PrepareStoreProcedure("getDISinfo");rn if(!bRtn)rn return 0;rn //这是输入<em>参数</em>rn m_Recordset.SetParam_String(1, szCountercode);rn//这两个是<em>输出</em><em>参数</em>,请问该如何实现rnm_Recordset.SetParam_String(2, szCountercode);rnm_Recordset.SetParam_String(3, szCountercode); rnm_Recordset.SafeOpen(_T("?=call getDISinfo(?)"));rnif(!m_Recordset.IsEOF())rnrn DISName = m_Recordset.GetString(0);rnrn rn m_Recordset.Close();rn m_db.Close();
vb调用输出参数存储过程?(紧急)
如何使用<em>ado</em><em>调用</em>带output<em>参数</em>的<em>存储过程</em>?rn问题是:如果使用vb的<em>ado</em><em>调用</em>,<em>参数</em>如何赋值?如何返回结果的记录集?或者说如何得到本<em>存储过程</em>中输入的OrderNo?rn<em>存储过程</em>的如下:rnCREATE PROC Gen_BillNorn@Restaurant smallint,rn@OrderNo varchar(16) outputrnASrndeclare @date smalldatetimerndeclare @Order numeric(12,0)rndeclare @New numeric(8,0) rndeclare @last_Order numeric(12,0)rndeclare @datestr varchar(12)rndeclare @olddatestr varchar(8)rndeclare @OldOrder numeric(8,0)rndeclare @id numeric(3,0)rndeclare @idstr varchar(4)rnrnrnset @New = 10000rnset @date = getdate()rnset @New = @New*Year(@date) + month(@date)*100 + day(@date)rnselect @last_Order=LastBillNo from RESTAURANT where ID=@Restaurantrnrnif (@last_Order) is not nullrn beginrn set @datestr=cast(@last_Order as varchar(11))rn set @olddatestr=left(@datestr,8)rn set @idstr=right(@datestr,3)rn set @OldOrder=cast(@olddatestr as numeric(8,0))rn set @id=cast(@idstr as numeric(3,0))rn if (@OldOrder >= @New)rn beginrn set @id=@id+1 rn set @Order = @OldOrder*1000+@idrn endrn elsern set @Order = @New*1000+1 rn endrnelsern set @Order = @New*1000+1rnset @OrderNo = cast(@Restaurant+10000 as varchar(5))rnset @OrderNo = right(@OrderNo,4) + '-'rnset @OrderNo = @OrderNo + cast(@Order as varchar(11))rnRETURNrnGOrn
调用输出参数的返回值存储过程问题
首先<em>存储过程</em>部分没有问题,测试过<em>存储过程</em>能<em>输出</em>返回值,以下代码中par3.Value的值为空,请问是哪里写错了吗?rn[code=C#]rnint PageIndex, PageSize, RecordCount, PageCount;rn PageIndex = Pager.CurrentPageIndex;rn PageSize = Pager.PageSize;rn RecordCount = 0;rn PageCount = 0;rnrnrn SqlConnection con = new SqlConnection(sqlcon);rn SqlCommand cmd = new SqlCommand("sp_getLword", con);rn cmd.CommandType = CommandType.StoredProcedure;rn SqlParameter par1 = new SqlParameter("@pageIndex", SqlDbType.Int);rn par1.Value = PageIndex;rn cmd.Parameters.Add(par1);rn SqlParameter par2 = new SqlParameter("@pageSize", SqlDbType.Int);rn par2.Value = PageSize;rn cmd.Parameters.Add(par2);rn SqlParameter par3 = new SqlParameter("@count", SqlDbType.Int,4);rn par3.Direction = ParameterDirection.Output;rn cmd.Parameters.Add(par3);rnrn con.Open();rn SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);rn RecordCount = Convert.ToInt32(par3.Value);rn Pager.RecordCount = RecordCount;rn DataList1.DataSource = dr;rn DataList1.DataBind();rnrnrn[/code]
关于如何调用及取回存储过程输出参数。。
<em>存储过程</em>如下:rncreate procedure sp_queryAuthorrn @Author_id varchar(10)='0000',rn @en int output,rn @em varchar(100) outputrnas rn if exists(select * from authors where Au_id like @Author_id+'%')rn beginrn set @en=1rn set @em='有此作者'+@Author_idrn returnrn endrnrnrn我想知道如果用TQuery应如何<em>调用</em>此<em>存储过程</em>。。如何写TQuery.sql
C++调用输出参数存储过程
初学Mysql,写了一个<em>输出</em><em>参数</em>和返回结果集的<em>存储过程</em>,用C++<em>调用</em>该<em>存储过程</em>,已能获取结果集,但是不知道怎么得到<em>输出</em><em>参数</em>?在网上搜索了下,也没有找到答案,希望有知道的告知下,谢谢!!
调用输出参数存储过程出错。
<em>参数</em>:rnsqlParameters = New SqlClient.SqlParameter() _rn New SqlParameter("@FillType", SqlDbType.Int), _rn New SqlParameter("@IceNo", SqlDbType.VarChar, 20), _rn New SqlParameter("@Maker", SqlDbType.NVarChar, 10), _rn New SqlParameter("@MakeTime", SqlDbType.DateTime), _rn New SqlParameter("@Remark", SqlDbType.NVarChar, 100), _rn New SqlParameter("@EndSign", SqlDbType.Bit), _rn New SqlParameter("@FillId", SqlDbType.VarChar, 30, ParameterDirection.Output)rn sqlParameters(0).Value = alListItem.Item(0)rn sqlParameters(1).Value = alListItem.Item(1)rn sqlParameters(2).Value = alListItem.Item(2)rn sqlParameters(3).Value = alListItem.Item(3)rn sqlParameters(4).Value = alListItem.Item(4)rn sqlParameters(5).Value = alListItem.Item(5)rn程序如下:rnDim cnn As New SqlClient.SqlConnection(WinUtility.WinConnString)rn Dim cmd As New SqlClient.SqlCommand("", cnn)rn Dim Trans As SqlTransactionrn cnn.Open()rn Trans = cnn.BeginTransactionrn cmd.Transaction = Transrn Tryrn cmd.CommandType = CommandType.StoredProcedurern cmd.CommandText = SPNameFirstrn Dim SqlParameter As SqlClient.SqlParameter() = GetParameters(alListItem, SPNameFirst)rn For Each pt As SqlClient.SqlParameter In SqlParameterrn cmd.Parameters.Add(pt)rn Nextrn cmd.ExecuteNonQuery()rnrn执行到:cmd.ExecuteNonQuery()出错,<em>存储过程</em>调试过没有问题,请问哪能出错了,谢谢。
求助:asp调用存储过程输出output参数
sql<em>存储过程</em>rnrnif exists(select * from sysobjects where name = 'Ncpe_sp_addAttach')rn drop procedure Ncpe_sp_addAttachrngornrnrncreate procedure Ncpe_sp_addAttachrnrn @attach_name varchar(100), --文件名称rn @attach_ext varchar(10),rn @provider_sid int,rn @local_url varchar(255),rn @attach_type varchar(10), rn @filesize int,rn @registerhuman_sid int,rn @registerhuman varchar(30),rn @newsid int outputrnasrnrndeclare @server_url varchar(100)rnrnexec getnextkey_proc 'DOC_ddi_attach', 'attach_sid', 1, @newsid outputrnrnset @server_url = '/' + @attach_type + '/' + cast(@provider_sid as varchar) + '/' + cast(@newsid as varchar) + @attach_extrnrninsert into DOC_ddi_attach(attach_sid, attach_name, attach_ext, attach_no, ddi_sid, ddi_ver_sid, local_url, server_url, create_man, rn is_main, attach_type, filesize, out_put, candown, canlook, canedit, recorder, record_date, record_name, candel,rn is_compress, area_sid)rn values(@newsid, @attach_name, @attach_ext, '', @provider_sid, 0, @local_url, @server_url, 0, rn 0, @attach_type, @filesize, 1, 1, 1, 1, @registerhuman_sid, getdate(), @registerhuman, 1, rn 0, 0)rnrngornrnrn----------------------------------------------------------------------------rnrnasp程序<em>调用</em><em>存储过程</em>部分rnrnSet MyComm = Server.CreateObject("ADODB.Command")rnwith MyCommrn.ActiveConnection = conn 'MyConStr是数据库连接字串rn.CommandText = "Ncpe_sp_addAttach" '指定<em>存储过程</em>名rn.CommandType = 4 '表明这是一个<em>存储过程</em>rn.Prepared = true '要求将SQL<em>命令</em>先行编译rn.Parameters.Append .CreateParameter("output",200,4)rnrn.Parameters.append .CreateParameter("@attach_name",200,100,1,attach_name)rn.Parameters.append .CreateParameter("@attach_ext",200,10,1,attach_ext)rn.Parameters.append .CreateParameter("@provider_sid",16,4,1,sid)rn.Parameters.append .CreateParameter("@local_url",200,255,1,ftp_files_to_put)rn.Parameters.append .CreateParameter("@attach_type",200,10,1,0005)rn.Parameters.append .CreateParameter("@filesize",16,4,1,filesize)rn.Parameters.append .CreateParameter("@registerhuman_sid",16,4,1,1)rn.Parameters.append .CreateParameter("@registerhuman",200,30,1,admin)rn.Parameters.append .CreateParameter("@newsid",16,4,3)rn.Executernend withrnif MyComm(0) = 1 thenrnUserName = MyComm(1)rnelsernUserName = "<em>信息</em>不存在"rnend ifrnrnrn想要读出newsid值,但是始终无法读出,怎么办,问题出在什么地方,大家们,帮我看一下。rn
c#中调用存储过程(含输出参数
定义<em>存储过程</em>:rnCREATE PROCEDURE countnumbers rn@number1 int outputrnASrnDeclare @SQL NVarchar(500)rnSelect @SQL='select @number1=count(stu_no) from marking where total_score>=90 rnExec sp_executesql @SQLrnGOrnc#中<em>调用</em><em>存储过程</em>的代码:rn //执行<em>存储过程</em>rn string cnnString = "Data Source=XIAO;Initial Catalog=markingonline;Integrated Security=True";rn SqlConnection con = new SqlConnection(cnnString);rn SqlCommand com = new SqlCommand();rn con.Open();rn com.CommandType = CommandType.StoredProcedure;rn //给出<em>存储过程</em>的名字rn com.CommandText = "countnumbers";rn //<em>输出</em><em>参数</em>rn com.Parameters.Add("@number1", SqlDbType.Int);rn com.Parameters["@number1"].Direction = ParameterDirection.Output;rn rn label9.Text = com.Parameters["@number1"].Value.ToString().Trim();rn rn com.Connection = con;rn com.ExecuteNonQuery();rn出错<em>信息</em>:label9.Text = com.Parameters["@number1"].Value.ToString().Trim();这句出错!未将<em>对象</em>引用设置到<em>对象</em>的实例rn请各位高手帮忙rn rnrn
Ado.Net调用带输入,输出参数存储过程
第一步:在数据中编写好通过编号来获取当前学生的更多<em>信息</em>的<em>存储过程</em>(以学生表为主,暂时不展示数据) ---根据编号来查询出学生的其他<em>信息</em>,带输入<em>输出</em><em>参数</em> if(exists(select * from sys.objects where name = 'proc_getStudentOtherInfoBySid'))    //判断当前数据库中是否存在这个<em>存储过程</em>    drop proc p
asp.net 调用存储过程输出参数问题
[color=#FF0000]Parameter '@ResultNum' not found in the collection.[/color]rn[code=SQL]rnCREATE DEFINER = 'root'@'localhost'rnPROCEDURE etm_one.P_CourseConflat(IN P_StartCourseGuid CHAR(36),rn IN P_EndCourseGuid CHAR(36),rn OUT ResultNum INT)rn[/code]rnrn这是<em>调用</em>的代码rn[code=C#]rnDbParameter[] parameter = new DbParameter[]dbHelper.CreateInDbParameter("P_StartCourseGuid",DbType.Guid,StartCourseGuid),rn dbHelper.CreateInDbParameter("P_EndCourseGuid",DbType.Guid,EndCourseGuid),rn dbHelper.CreateOutDbParameter("ReturnNum",DbType.Int32,result);rnrn dbHelper.ExecuteNonQuery(CommandType.StoredProcedure, "P_CourseConflat", parameter);rn result = GetInt(parameter[2].Value);rn[/code]rnrnasp.net <em>调用</em><em>存储过程</em>的<em>输出</em><em>参数</em>时出现上面那个错误,网上查了下,说是<em>mysql</em>的问题。知道怎么解决的指教下。rn
oci 调用存储过程,带SYS_REFCURSOR输出参数
rnoracle数据库中 <em>存储过程</em>如下:rn-----------------------------------------------------rnPROCEDURE A101502(rn USER_NO IN NUMBER ,rn LOGIN_PASS IN VARCHAR2,rn R_DATE OUT SYS_REFCURSORrn)rnASrnV_USER_NO NUMBER(8);rnV_LOGIN_PASS VARCHAR2(64);rnBEGINrn V_USER_NO := USER_NO;rn V_LOGIN_PASS := LOGIN_PASS;rn rn OPEN R_DATE FOR rn SELECT *rn FROM E_USERSrn WHERE USER_NO = V_USER_NOrn AND LOGIN_PASS = V_LOGIN_PASS;rn rn rnrnEND A101502;rn-------------------------------------------------------rn我用oci怎样<em>调用</em>这个<em>存储过程</em>,并且取出<em>输出</em><em>参数</em>啊,求大神给个实例代码啊,急,急,急
调用oracle带有输出参数存储过程的问题
<em>存储过程</em>如下:rnCREATE OR REPLACE PROCEDURE CheckInrn(rn 输入编号 IN varchar2,rn 输入密码 IN varchar2,rn ret OUT integerrn)rnASrn是否存在 int;rn正确密码 varchar(20);rnBEGINrnSELECT COUNT(*) into 是否存在rnFROM AdminrnWHERE 编号 = 输入编号;rnIF( 是否存在=0)rnTHENrndbms_output.put_line('输入的管理员编号不存在');rnret:=0;rnEND IF;rnSELECT 密码 into 正确密码rnFROM Admin rnWHERE 编号 = 输入编号;rnIF(输入密码 != 正确密码)rnTHENrndbms_output.put_line( '密码不正确,请重新输入');rnret:=-1;rnELSErndbms_output.put_line('登录成功!');rnret:=1;rnEND IF;rnEND;rnrn※※※※※※※※※※※※※※※※※※※※※※※※※※※※rn<em>调用</em>的代码如下:rn_CommandPtr cmd;rncmd.CreateInstance(__uuidof(Command));rn_ParameterPtr paramIn1,paramIn2,paramOut;rnparamIn1=cmd->CreateParameter("paramIn1",adVarChar,adParamInput,20,_variant_t("001"));rncmd->Parameters->Append(paramIn1);rnparamIn2=cmd->CreateParameter("paramIn2",adVarChar,adParamInput,20,_variant_t("001"));rncmd->Parameters->Append(paramIn2);rnparamOut=cmd->CreateParameter("paramOut",adInteger,adParamOutput,4,_variant_t("0"));rncmd->Parameters->Append(paramOut);rncmd->ActiveConnection=m_pConnection;//m_pConnection是建立好的数据库连接,没有问题rncmd->CommandType=adCmdStoredProc;rncmd->CommandText="checkin";rncmd->Execute(NULL, NULL, adCmdStoredProc);rnint r = paramOut->Value.intVal;rnrncatch(_com_error e)rnrnMessageBox(e.Description());rnrnrn编译可以通过,但是执行时说“too many arguments......”什么的,是什么原因啊?怎么解决?rnrn<em>存储过程</em>在sql*plus里可以正常运行的,接受3个<em>参数</em>rnrn大侠帮帮忙啊,为这个问题头疼了一天了……rnrn解决了就给分,只给第一个正确解决了这个问题的!rn
vb2005调用存储过程如何取得输出参数???
我有个<em>存储过程</em>名称为:P_chepai。里面内容如下:rnCREATE PROCEDURE P_chepairn@Num int,rn@ZhanDian varchar(30),rn@ChePai varchar(30) outputrnASrnselect @ChePai=smVehicheCard from VehicheCard where smID=@Num and smParentStr=@ZhanDianrnGOrnrn 输入<em>参数</em>两个,<em>输出</em><em>参数</em>一个。rnrnvb 2005中程序使用:rn Dim StrStoreID As Integer = 82646rn Dim StrStoreStr As String = "老路计重仪"rnrn Dim Dcolink As New SqlClient.SqlConnection("Data Source=LOCALHOST;Initial Catalog=ZSJiZhong;User ID=sa1")rn Dim dcmtmp As New SqlClient.SqlCommand("P_chepai", Dcolink)rn Dcolink.Open()rnrn dcmtmp.CommandType = CommandType.StoredProcedurern '添加输入变量 rn dcmtmp.Parameters.AddWithValue("@Num", StrStoreID)rn dcmtmp.Parameters.AddWithValue("@ZhanDian", StrStoreStr)rnrn '定义<em>输出</em>变量 rn Dim param As SqlClient.SqlParameterrn param = dcmtmp.Parameters.AddWithValue("@ChePai", SqlDbType.VarChar)rn param.Direction = ParameterDirection.Outputrnrn dcmtmp.ExecuteNonQuery()rn TextBox5.Text = param.Value.ToStringrnrn我的目的是取得<em>输出</em><em>参数</em>的值,现在的问题是:程序运行到“dcmtmp.ExecuteNonQuery()” 出错,抛出“将数据<em>类型</em> varchar 转换为 int 时出错”, 搞不懂,请问这是怎么回事???
java 里面调用输出参数存储过程
proc=con.prepareCall("(?,?)=call pl_flow.OpenWorkList(?,?,?)");rn谁知道JAVA里面<em>调用</em>多<em>输出</em><em>参数</em>的<em>存储过程</em>怎么申名???rnrn该<em>存储过程</em>如下:rn PL_FLOW.OpenWorkList( rn pworklist_filter => 'STATE=''NOTRUNNING''',rn pworklist_filter 'a.atri_id=10 AND a.value=TO_CHAR(7788)', -- ID of Scott.rn pati_id_in => l_pati_id_manager, -- this is the ID of jonesrn count_flag => 0, -- should rowcount be returned?rn pquery_handle => l_worklist_cursor,rn pcount => l_dummy_intrn );rnrnpquery_handle是一个游标<em>输出</em><em>参数</em>,pcount 是一个整树<em>输出</em><em>参数</em>,前3个是in<em>参数</em>
关于C#调用输出参数存储过程
请问一下大家一般是怎么处理带<em>输出</em><em>参数</em>的<em>存储过程</em>的啊?有没有什么好的方法
Asp.net(C#) 调用存储过程输出参数的值
CREATE PROCEDURE spr_dinid(@din_id int output) ASrnselect @din_id=(select corp_sprdinid+1 from dbo.info_corp)rnif @din_id>0rn beginrn update dbo.info_corp set corp_sprdinid=corp_sprdinid+1 rnendrnrnrn//得到 string dinid值为"@din_id"
asp调用存储过程输出参数,无法实现
<em>存储过程</em>rnCREATE PROCEDURE test11rn@begdate datetime,@empid varchar(6),@dutytree varchar(200) outputrnAS rndeclare cur cursor for SELECT dutyid, validdate FROM ChangernWHERE (dutychange = 1) AND (validdate ,200,2,200) rn MyComm.Executern tree=MyComm(2) rn response.write treern
asp调用输出参数存储过程
asp如何调带<em>输出</em><em>参数</em>的<em>存储过程</em> rnrn<em>存储过程</em>返回一个 字符串rnrn如何在 在asp中取得这个字符串
急,急,存储过程输出参数调用问题??
[color=#FF0000]public SqlParameter[] DealwithCrimeCount=new SqlParameter[3]; [/color]rnpublic void GetDealwithCrimCount(DateTime timeStart, DateTime timeEnd) rn rn rn DealwithCrimeCount[0] = new SqlParameter("@DealwithCrimeCount1",SqlDbType.Int,4); rn DealwithCrimeCount[1] = new SqlParameter("@DealwithCrimeCount2", SqlDbType.Int, 4); rn DealwithCrimeCount[2] = new SqlParameter("@DealwithCrimeCount3", SqlDbType.Int, 4); rn ; rn DealwithCrimeCount[0].Direction = ParameterDirection.Output; //为<em>存储过程</em>的<em>输出</em><em>参数</em> rn DealwithCrimeCount[1].Direction = ParameterDirection.Output; rn DealwithCrimeCount[2].Direction = ParameterDirection.Output; rnrn DataSet ds = this.dbProcessor.RunProcedure("Cup_Work_GetDealwithCrimecount", DealwithCrimeCount, "GetDealwithCrimeCount"); rn DataTable dt = ds.Tables["GetDealwithCrimeCount"]; rn rn其中DealwithCrimeCount[0],DealwithCrimeCount[1],DealwithCrimeCount[2]是<em>存储过程</em>Cup_Work_GetDealwithCrimecount里的<em>输出</em><em>参数</em>,我将他放在数组DealwithCrimeCount里,[color=#FF0000]现在我想在本页面<em>调用</em>这几个<em>输出</em><em>参数</em>,怎么写啊??望指教??[/color]
调用输出参数存储过程(oracle)
我使用的工具是navicat declare V_questionid VARCHAR2(100) ; --输入<em>参数</em> V_replay clob; --<em>输出</em><em>参数</em> BEGIN DBMS_OUTPUT.ENABLE(buffer_size =&amp;amp;gt; null) ; --设置缓存大小 V_questionid := '2079439a1d0a428...
关于存储过程----调用 'UP_IRRGUANLIJIGOU_DELETE' 时参数个数或类型错误
<em>调用</em>方法为:rnpublic void Delete(int ID)rn rnrn int rowsAffected;rn OracleParameter[] parameters = rn new OracleParameter("ID", OracleType.Number),rn new OracleParameter("rf",OracleType.Number),rn ;rn parameters[0].Value = ID;rn rn rn int i = DbHelperOra.RunProcedure("UP_IRRGUANLIJIGOU_Delete", parameters, out rowsAffected);rn rnrnrnrn<em>存储过程</em>为:rncreate or replace procedure UP_IRRGUANLIJIGOU_Delete(ID in number,rf out number) isrnbeginrn DELETE From IRRGUANLIJIGOU jgrn WHERE jg.jgid = ID;rn rf := sql%rowcount;rnend UP_IRRGUANLIJIGOU_Delete;rnrnrn请高手帮忙解决,非常感谢!在线等(第一次使用oracle)
调用某个存储过程参数个数或类型错误?
我用C#开发asp.net。数据库用的是oraclern我写了一个<em>存储过程</em>如下:rncreate or replace package types rnas rn type cursorType is ref cursor; rnend; rn/rnCREATE OR REPLACE PROCEDURE selectStudents(student_id IN VARCHAR2,rn O_RESULT_SET OUT types.cursorType)rn ASrn BEGINrn OPEN O_RESULT_SET FORrn SELECT *rn FROM studentrn WHERE studentid = student_id;rn END;rn/rn在配置数据源测试的时候,出错:rnPLS-00306: <em>调用</em>‘selectStuents’时<em>参数</em>个数或<em>类型</em>错误!rnrn这是怎么回事呢?
存储过程输出参数能用表变量吗?
create proc testrn@varTable1 table output,rn@varTable2 table outputrnasrngornrn提示table附近有错误,如果不行的话。那我要在执行该<em>存储过程</em>后返回若干个表的内容怎么办?(用临时表?)
三层架构调用带有输出参数存储过程
三层架构<em>调用</em>带有<em>输出</em><em>参数</em>的<em>存储过程</em>rn三层架构<em>调用</em>带有<em>输出</em><em>参数</em>的<em>存储过程</em>(asp.net)rnrn在DAL 和BLL层里该怎么写..rn
oralce调用输出参数存储过程
[code=SQL]create or replace procedure SP_PART_FAMILY(pPersonid IN char ,retcode out char ,retMsg out char)[/code]rn<em>存储过程</em>的<em>参数</em>是这样的,带有两个<em>输出</em><em>参数</em>,这两个<em>参数</em>是<em>输出</em><em>存储过程</em>执行完毕后<em>输出</em>的反馈<em>信息</em>rn在PL/SQL 中<em>调用</em>该<em>存储过程</em>时该如何写呢rn我写的call SP_PART_FAMILY('123456','','')rn后面两个<em>输出</em><em>参数</em>不知道该怎么写了rn问题比较简单大家帮帮忙了
beetlsql 调用带有输出参数存储过程
List&lt;Integer&gt; listResult = cdao.getSQLManager().executeOnConnection(new OnConnection&lt;List&lt;Integer&gt;&gt;() { @Override public List&lt;Integer&gt; call(Connection...
如何调用输出参数存储过程
CREATE PROCEDURE Build_SPrn@Str_ZW as char(40),rn@Str_PY as char(20) outputrnASrn select @Str_PY=...... rnreturnrnGOrnrn我用 rndim pydm as stringrnRS.open "exec Build_sp " & text1.text & "," & pydm & "Output"rn出错,怎么才能把Build_sp 的@Str_PY这个<em>输出</em><em>参数</em>赋值给变量pydm?
asp.net调用存储过程参数必须存储过程里的一样
名字不一样就报错,<em>必须</em>得一样?时间长了,谁还记得住
mysql修改字段长度命令
修改字段<em>长度</em><em>命令</em> alter table 表名 modify column 列名 <em>类型</em>(要修改的<em>长度</em>); alter table bank_branch_number modify column bankId varchar(10);
ADO调用oracle存储过程,怎么获取存储过程的blob类型输出参数呢?
blob传入都可以,就是不知道怎么传出。
为什么用TClientDataSet调用输出参数存储过程出错:提供了不一致或不完整的信息
为什么用TClientDataSet<em>调用</em>带<em>输出</em><em>参数</em>的<em>存储过程</em>出错:<em>提供</em>了不一致或不完整的<em>信息</em>?
mysql 文本类型长度
TINYTEXT 256 bytes   TEXT 65,535 bytes ~64kb MEDIUMTEXT  16,777,215 bytes ~16MB LONGTEXT 4,294,967,295 bytes ~4GB           CHAR(n) 固
command对象使用参数调用存储过程的问题
各位大虾:请指教!rn 我想将文章存入数据库,<em>调用</em>一个含有两个<em>参数</em>的<em>存储过程</em>,两个<em>参数</em>分别将文章的标题(title)和内容(filebody)两个部分传入,由于内容(filebody)很长,在command中如何定义parameter的<em>类型</em>?rn 下面是我的尝试,filebody如果是较短的字符串就没有问题,但输入较长的字符串就出现错误提示了rnrn 我建立一个有两个<em>参数</em>的<em>存储过程</em>如下:rn create procedure addnewsrn ( @title varchar(50),@filebody text )rn asrn insert into information (title,filebody) values (@title,@filebody)rnrn 然后在asp中用如下语句:rntitle=request.form("title")rntext=request.form("text")rnrnset conn=server.createobject("<em>ado</em>db.connection")rnconn.open "driver=sql server;database=customsweb;server=local;uid=sa;pwd="rnset comm=server.createobject("<em>ado</em>db.command")rncomm.activeconnection=connrncomm.commandtype=adcmdstoredprocrncomm.commandtext="addnews"rncomm.parameters.append comm.createparameter("title",advarchar,adparaminput,50)rncomm.parameters.append comm.createparameter("textbody",adlongvarchar,adparaminput,201)rnrncomm.parameters("title")=titlerncomm.parameters("textbody")=textrncomm.executernrn一执行就出现rn“ADODB.Parameter 错误 '800a0d5d' 应用程序目前操作所使用的值的<em>类型</em>不正确。 ”rn如果在textbody中输入较少的字符串就一切正常。rn
数组必须指定长度吗?
string[] abc=new string[];rnint i;rnrnwhile(ObjData.Read())rnrnabc[i]=ObjData["menuname"].ToString;rni+=1;rnrn为什么出是数组出错呢?rnrn如果这样就可以:rnrnstring[] abc=new string[10];rn
usb--CAN通讯方面的案例下载
can通讯方面的案例,vc++,有源代码。 相关下载链接:[url=//download.csdn.net/download/hellenzhang126/2413887?utm_source=bbsseo]//download.csdn.net/download/hellenzhang126/2413887?utm_source=bbsseo[/url]
电脑维修之葵花宝点使用大秘籍下载
电脑维修之葵花宝点使用大秘籍 相关下载链接:[url=//download.csdn.net/download/laiyufei002/3030831?utm_source=bbsseo]//download.csdn.net/download/laiyufei002/3030831?utm_source=bbsseo[/url]
凯图CAD破解方法!下载
目前大多用的凯图CAD是学习版的,下载这个可以使其破解,里面有个TXT文档有具体使用说明! 相关下载链接:[url=//download.csdn.net/download/wlizhiyy/3420661?utm_source=bbsseo]//download.csdn.net/download/wlizhiyy/3420661?utm_source=bbsseo[/url]
相关热词 c#单元测试入门 c# 数组转化成文本 c#实体类主外键关系设置 c#ocrt能识别中文吗 c# 子函数 局部 c#窗口位置设置 c# list 查询 c# 事件 执行顺序 c# 不同数据库 创建表 c# tcp通信客户端类
我们是很有底线的