提示百万 必须宣告变数'@e_no'

问题描述

publicstaticOleDbTypeget_SqlDbType(stringColumnType){OleDbTyperGet=OleDbType.Integer;switch(ColumnType){case"int":rGet=OleDbType.Integer;break;case"intidentity":rGet=OleDbType.Integer;break;case"decimal":rGet=OleDbType.Decimal;break;case"char":rGet=OleDbType.VarChar;break;case"nchar":rGet=OleDbType.VarChar;break;case"bit":rGet=OleDbType.Integer;break;case"float":rGet=OleDbType.VarNumeric;break;case"money":rGet=OleDbType.VarNumeric;break;case"datetime":rGet=OleDbType.DBDate;break;case"image"://rGet=OleDbType.break;case"text":rGet=OleDbType.VarChar;break;case"ntext":rGet=OleDbType.VarChar;break;case"numeric":rGet=OleDbType.Decimal;break;case"varchar":rGet=OleDbType.VarChar;break;case"nvarchar":rGet=OleDbType.VarChar;break;}returnrGet;}///多表用适配器更新,使用事务成功则提交,失败则回滚。///在调用该方法外面申明事务、连接,再循环调用此方法更新///</summary>///<paramname="trans">事务</param>///<paramname="Connection">数据库连接</param>///<paramname="da">适配器,多表中必须在调用方法前申明</param>///<paramname="dataSet">修改的数据集</param>///<paramname="tableName">更新的表名</param>///<paramname="ID_Name">唯一关键字</param>///<paramname="constring">连接字符串</param>publicstaticvoidUpdateDataset(OleDbConnectionConnection,DataSetdataSet,stringtableName,stringID_Name){stringsValue="";stringsColName="";stringsUpdate="";intcolWidth=10;OleDbTypecolType;colType=OleDbType.VarChar;DataSetds=newDataSet();ds=rtnds("execsp_columns'"+tableName+"'",Connection);//SqlHelper.FillDataset(constring,CommandType.Text,"execsp_columns'"+tableName+"'",ds,newstring[]{"ArrayCol"});foreach(DataRowsRowinds.Tables[0].Rows){if(sRow["type_name"].ToString()!="intidentity"){if(sRow["column_def"].ToString().Trim()!="(getdate())"){colType=get_SqlDbType(sRow["type_name"].ToString());stringColumn_name=sRow["Column_Name"].ToString();sValue+=(sValue==""?"":",")+"@"+Column_name;sColName+=(sColName==""?"":",")+Column_name;sUpdate+=(sUpdate==""?"":",")+Column_name+"=@"+Column_name;}}}stringsInsert="INSERTinto"+tableName+"("+sColName+")values("+sValue+")";stringsaUpdate="update"+tableName+"set"+sUpdate+"where"+ID_Name+"=@id_name";stringsDelete="Delete"+tableName+"where"+ID_Name+"=@id_name";OleDbCommandinsertCommand=newOleDbCommand(sInsert,Connection);OleDbCommandupdateCommand=newOleDbCommand(saUpdate,Connection);OleDbCommanddeleteCommand=newOleDbCommand(sDelete,Connection);//OleDbTransactiontrans=Connection.BeginTransaction();//if(trans!=null)//{//if(trans.Connection==null)thrownewArgumentException("Thetransactionwasrollbackedorcommited,pleaseprovideanopentransaction.","transaction");//insertCommand.Transaction=trans;//updateCommand.Transaction=trans;//deleteCommand.Transaction=trans;//}insertCommand.CommandType=CommandType.Text;updateCommand.CommandType=CommandType.Text;deleteCommand.CommandType=CommandType.Text;foreach(DataRowsRowinds.Tables[0].Rows){if(sRow["type_name"].ToString()!="intidentity"){if(sRow["column_def"].ToString().Trim()!="(getdate())"){colType=get_SqlDbType(sRow["type_name"].ToString());colWidth=(int)sRow["length"];stringColumn_name=sRow["Column_Name"].ToString();updateCommand.Parameters.Add("@"+Column_name,colType,colWidth,Column_name);if(Column_name==ID_Name){OleDbParameterupdateparm=updateCommand.Parameters.Add("@id_name",colType,colWidth,ID_Name);updateparm.SourceVersion=DataRowVersion.Original;OleDbParameterdeleteparm=deleteCommand.Parameters.Add("@id_name",colType,colWidth,ID_Name);deleteparm.SourceVersion=DataRowVersion.Original;}insertCommand.Parameters.Add("@"+Column_name,colType,colWidth,Column_name);}}}OleDbDataAdapterdataAdapter=newOleDbDataAdapter();dataAdapter.InsertCommand=insertCommand;dataAdapter.UpdateCommand=updateCommand;dataAdapter.DeleteCommand=deleteCommand;try{dataAdapter.Update(dataSet);}catch(System.ArgumentNullExceptione1){thrownewArgumentNullException(e1.Message);}catch(System.Data.SqlClient.SqlExceptione2){thrownewException(e2.Message);}}调用方法按按钮事件ds对应的数据集为 stringls_sql="selectep01NEW.E_NO,ep01NEW.e_name,EP70.E70_CLASS_NAMEfromep01NEW,EP70";ls_sql+="whereep01NEW.E_NO='ay0005'ANDEP70.E70_KIND='A'ANDep01NEW.E_DEPT=EP70.E70_KIND_NAME";oleconn=ConnData.Conntodatabase();ConnData.UpdateDataset(oleconn,ds,"ep01NEW","e_no");一上午头都晕了都不知道

解决方案

解决方案二:
try{dataAdapter.Update(dataSet);}这里出错,提示必须宣告变数'

时间: 2024-09-30 01:44:05

提示百万 必须宣告变数&amp;#x27;@e_no&amp;#x27;的相关文章

JS里面出现Cannot set property &amp;amp;#x27;onfocus&amp;amp;#x27; of undefined的错误提示

问题描述 这是html里的:<divclass="dropdown"id="dropbox"><divclass="narrowfeedback"><textareaname="add_comment"class="sayno"placeholder="不说点什么吗?"></textarea></div></div>

出錯啦! 名稱 &amp;amp;#x27;My&amp;amp;#x27; 未宣告。

问题描述 我用的是vb.net,程式運行時出現錯誤:"名稱'My'未宣告."我的代碼是這樣的DimOpenFileDialogAsNewOpenFileDialogOpenFileDialog.InitialDirectory=My.Computer.FileSystem.SpecialDirectories.MyDocuments請問要怎麼宣告My啊,我的程式問題在哪里呢? 解决方案 解决方案二:LZ用的是VS哪个版本?VS2005(即.net2.0)及之后的版本才有My这个命名空间

运行添加用户方法后. 提示:行:1 Char:23 错误:缺少&amp;amp;#x27;)&amp;amp;#x27; 代码:0

问题描述 protectedvoidbtnAdd_Click(objectsender,EventArgse){Adduser();}protectedvoidAdduser(){SqlConnectioncon=newSqlConnection(ConfigurationManager.AppSettings["conn"].ToString());SqlCommandcom=newSqlCommand("insertintoUserBase(user_Name,user_

swift上传文件提示“the volume &amp;amp;#x27;sdb1&amp;amp;#x27; has only 135.2kb disk space remaining”

问题描述 按照官方SAIO文档单节点部署的swift,做测试上传文件时出现如上提示,是怎么回事呢?文件的大小超过了storagenode的容量吗?怎样调节storagenode的存储大小呢?求高人指点. 解决方案 解决方案二:重新装一遍,在执行truncate-s1GB/srv/swift-disk时把1GB改到适合的值

MVC+EF6+Oracle,提示ORA-01918: user &amp;amp;#x27;dbo&amp;amp;#x27; does not exist

问题描述 如题,怎么解决这个问题Oracle.ManagedDataAccess.EntityFramework-ORA-01918:user'dbo'doesnotexist错误参考:http://stackoverflow.com/questions/27250555/oracle-manageddataaccess-entityframework-ora-01918-user-dbo-does-not-existmodelBuilder.HasDefaultSchema("MyOracle

BeanFactory not initialized or already closed - call &amp;amp;#x27;refresh&amp;amp;#x27; ....

问题描述 osgi下编写一个bundle,在apache-fuse的servicemix.bat下使用命令osgi:update178(bundleid),出现以下提示:BeanFactorynotinitializedoralreadyclosed-call'refresh'beforeaccessingbeansviatheApplicationContext.atorg.springframework.context.support.AbstractRefreshableApplicati

对象名 &amp;amp;#x27;users_info&amp;amp;#x27; 无效。

问题描述 这个我确定有的,在本地执行正常,挂到服务器就报这样的错对象名'users_info'无效.说明:执行当前Web请求期间,出现未处理的异常.请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息.异常详细信息:System.Data.SqlClient.SqlException:对象名'users_info'无效.源错误:行320:{行321:行322:throwe;行323:}finally{connection.Close();}行324:}源文件:e:Inetpub

在应用程序级别之外使用注册为 allowDefinition=&amp;amp;#x27;MachineToApplication&amp;amp;#x27; 的节是错误的。

问题描述 在应用程序级别之外使用注册为allowDefinition='MachineToApplication'的节是错误的.如果在IIS中没有将虚拟目录配置为应用程序,则可能导致此错误..<?xmlversion="1.0"encoding="utf-8"?><configuration><appSettings><addkey="dsn"value="persistsecurityinfo

error C2061: syntax error : identifier &amp;amp;#x27;CComVariant&amp;amp;#x27;

问题描述 项目是VC6转成VC2010的ATLcom工程,出现了未定义错误,可以右键定位到定义文件,但是就是一直提示error未定义那个数据类型错误,谁知道会是什么错误?请大侠不惜赐教!1>------Buildstarted:Project:VideoControl,Configuration:DebugWin32------1>stdafx.cpp2>------Buildstarted:Project:Render,Configuration:DebugWin32------2&g