我刚发了这个贴,找不到了,不知道怎么解决---数据库读写的问题,(谁能告诉我,在线等.)
<%
Dim MyConnection As SqlConnection
Dim Mycommand As SqlDataAdapter
Dim Ds As DataSet
Dim dt As DataTable
Dim Connstring ,SQl,SQL2 As String
Connstring="Server=dell6400;uid=sa;pwd=123;DataBase=whjgweb"
Sql="Select * from sggcjbqkb where gcbm=" & Request("id")
MyConnection=New SqlConnection(Connstring)
Mycommand=New SqlDataAdapter(sql,Connstring)
Ds=New DataSet()
myCommand.Fill(ds,"sggcjbqkb")
dt=ds.Tables("sggcjbqkb")
Response.Write("工程编号:"& dt.Rows(0).Item("gcbm "))
Response.Write("项目名称:" & dt.Rows(0).Item("xmmc "))
Response.Write("工程建设地点:" & dt.Rows(0).Item("gcJsdd "))
Response.Write("工程类别:" & dt.Rows(0).Item("Gclb"))
Response.Write("结构类型:" & dt.Rows(0).Item("Jglx"))
Response.Write("投资总额:" & dt.Rows(0).Item("Tzze"))
Response.Write("政府投资:" & dt.Rows(0).Item("Zftz"))
Response.Write("自筹投资:" & dt.Rows(0).Item("Zctz"))
Response.Write("贷款投资:" & dt.Rows(0).Item("Dktz"))
Response.Write("外商投资:" & dt.Rows(0).Item("Wstz"))
Response.Write("其他投资:" & dt.Rows(0).Item("Qttz"))
Response.Write("工程规模:" & dt.Rows(0).Item("Gcgm"))
Response.Write("建筑面积:" & dt.Rows(0).Item("Jzmj"))
Response.Write("用地面积:" & dt.Rows(0).Item("ydmj"))
Response.Write("栋 数:" & dt.Rows(0).Item("ds"))
Response.Write("地上层数:" & dt.Rows(0).Item("dscs"))
Response.Write("地下层数:" & dt.Rows(0).Item("dxcs"))
Response.Write("最大高度:" & dt.Rows(0).Item("zdgd"))
Response.Write("最大跨度:" & dt.Rows(0).Item("zdkd"))
Response.Write("计划开工日期:" & dt.Rows(0).Item("Jhkgrq"))
Response.Write("计划竣工日期:" & dt.Rows(0).Item("Jhjgrq"))
Response.Write("建设性质:" & dt.Rows(0).Item("Jsxz"))
Response.Write("项目建设内容:" & dt.Rows(0).Item("Xmjsnr"))
Response.Write("建设性质:" & dt.Rows(0).Item("Jsxz"))
Response.Write("建设用地规划许可证编号:" & dt.Rows(0).Item("sydghxkzbh"))
Response.Write("建设工程规划许可证号:" & dt.Rows(0).Item("jsgcGhxkzh "))
Response.Write("建设单位名称:" & dt.Rows(0).Item("Jsdwmc"))
Response.Write("建设单位地址:" & dt.Rows(0).Item("Jsdwdz"))
Response.Write("建设单位性质:" & dt.Rows(0).Item("Jsdwxz"))
Response.Write("建设单位银行资信证明:" & dt.Rows(0).Item("Jsdwyhzxzm"))
Response.Write("建设单位法人代表:" & dt.Rows(0).Item("Jsdwfrdb"))
Response.Write("建设单位性质:" & dt.Rows(0).Item("Jsdwxz"))
Response.Write("建设单位联系人:" & dt.Rows(0).Item("Jsdwlxr"))
Response.Write("建设单位上级主管部门:" & dt.Rows(0).Item("Jsdwsjglbm"))
Response.Write("立项文件名称:" & dt.Rows(0).Item("Lxwjmc"))
Response.Write("立项批准时间:" & dt.Rows(0).Item("Lxpzsj"))
Response.Write("立项批准面积:" & dt.Rows(0).Item("Lxpzmj"))
Response.Write("立项批准投资:" & dt.Rows(0).Item("Lxpztz"))
Response.Write("立项批准规模:" & dt.Rows(0).Item("Lxpzgm"))
Response.Write("立项批准机关:" & dt.Rows(0).Item("Lxpzjg"))
Response.Write("立项批准文号:" & dt.Rows(0).Item("Lxpzwh"))
Response.Write("立项批准投资:" & dt.Rows(0).Item("Lxpztz"))
Response.Write("备 注:" & dt.Rows(0).Item("Bz"))
Response.Write("工程规模技术指标(一):" & dt.Rows(0).Item("gcgmjszb1"))
Response.Write("工程规模技术指标(二):" & dt.Rows(0).Item("gcgmjszb2"))
Response.Write("建设单位联系电话:" & dt.Rows(0).Item("jsdwlxdh"))
Response.Write("数 量 (一):" & dt.Rows(0).Item("sl1"))
Response.Write("数 量 (二):" & dt.Rows(0).Item("sl2"))
Response.Write("单 位 (一):" & dt.Rows(0).Item("dw1"))
Response.Write("单 位 (二):" & dt.Rows(0).Item("dw2"))
%>
运行时报如下错误:
数据类型 varchar 转换为 numeric 时出错。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.SqlClient.SqlException: 将数据类型 varchar 转换为 numeric 时出错。
源错误:
行 227: Mycommand=New SqlDataAdapter(sql,Connstring)
行 228: Ds=New DataSet()
行 229: myCommand.Fill(ds,"sggcjbqkb")
行 230: dt=ds.Tables("sggcjbqkb")
行 229: myCommand.Fill(ds,"sggcjbqkb")为运行编译指出的错误
我找了N遍,不知道原因在哪.