问题描述
有一段数据提交页面的代码,想提交时同时将数据更新和插入到两台服务器的不同数据库和不同数据表中,现在更新可以,但插入不行.DimmFieldsStrAsStringDimmValuesStrAsStringDimmSqlAsStringDimdmssqlAsString'插入DMS工程文件DOC2的SQL语句IfMe.IsValid=FalseThenExitSubEndIfmSql="updatecomponentsetcontrolno='"+tControlNo.Text.Trim.ToUpper+"',auditname='"+tUserId.Text.Trim+"',auditdate='"+tDate.Text+"',state='生效',ReturnInfo='待审核'whereid="+tID.TextDimmCnAsSqlClient.SqlConnectionDimmCmdAsSqlClient.SqlCommandmCn=NewSqlClient.SqlConnection("workstationid=ZHANG;packetsize=4096;userid=sa;password=123;datasource=WEB;persistsecurityinfo=False;initialcatalog=EDC")mCmd=NewSqlClient.SqlCommandmCmd.Connection=mCnmCmd.CommandType=CommandType.TextmCmd.CommandText=mSqlmCn.Open()mCmd.ExecuteNonQuery()mCn.Close()mCmd=Nothing'在此增加语句插入对DMS进行操作mFieldsStr="control_no,issue_date,rev,p_n,pages,name,IssueBy"mValuesStr="'"+tControlNo.Text.Trim.ToUpper+"','"+tDate.Text+"','"+tRev.Text.Trim+"','"+tPartNum.Text.Trim+"','"+tPages.Text.Trim+"','"+tPartDesc.Text.Trim+"','"+tWriteBy.Text.Trim+"'"dmssql="insertintodoc2("+mFieldsStr+")values("+mValuesStr+")"DimnCnAsSqlClient.SqlConnectionDimnCmdAsSqlClient.SqlCommandnCn=NewSqlClient.SqlConnection("workstationid=HEN;packetsize=4096;userid=sa;password=123;datasource=SVR;persistsecurityinfo=False;initialcatalog=Doc")nCmd=NewSqlClient.SqlCommandnCmd.Connection=nCnnCmd.CommandType=CommandType.TextnCmd.CommandText=dmssqlnCn.Open()nCmd.ExecuteNonQuery()nCn.Close()nCmd=NothingResponse.Write("审核成功!")Response.End()EndSub
解决方案
解决方案二:
该回复于2008-09-03 09:33:04被版主删除