| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 980 人关注过本帖
标题:求助:设计遇到个问题,请高手们帮下忙!
只看楼主 加入收藏
freedomGD
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-6-4
收藏
 问题点数:0 回复次数:0 
求助:设计遇到个问题,请高手们帮下忙!
我做了个模糊查询,但运行时总出现"未处理的“System.Data.OleDb.OleDbException”类型的异常出现在 system.data.dll 中。"光标总停在 objda.Fill(objds, "xs"),请高手们告诉我出了什么问题,谢谢!


代码如下:
 Public Sub bindgridview(ByVal strXH As String)
        Dim objconn As New OleDb.OleDbConnection
        Dim objda As New OleDb.OleDbDataAdapter
        Dim objcomm As New OleDb.OleDbCommand
        Dim objds As New DataSet
        Dim wherestr As String

objconn.ConnectionString = "Provider=Microsoft.jet.OLEDB.4.0;data source='C:\Documents and Settings\Administrator\桌面\学生成绩管理系统\XSCJ.mdb'"

objcomm.Connection = objconn
        objda.SelectCommand = objcomm
        Dim builder As OleDb.OleDbCommandBuilder = New OleDb.OleDbCommandBuilder(objda)

        objconn.Open()
        objda.Fill(objds, "xs")                   ( 绿光标停在此处)

        objconn.Close()
        DataGrid1.DataSource = objds.Tables("xs")
End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim wherestr As String
        Dim objds As New DataSet
        wherestr = ""
        If Trim(txtxh.Text) <> "" Then
            wherestr = "Select * form xs where xh like % & Trim(txtxh.Text) & %"
            MsgBox(wherestr)
        End If

        objds.Tables.Clear()           
        bindgridview(WhereStr)

End Sub
搜索更多相关主题的帖子: Microsoft Dim New OleDb 
2008-06-06 14:40
快速回复:求助:设计遇到个问题,请高手们帮下忙!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018438 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved