主题:大哥,大姐些都来看一下呀,问题!!1
Public Class Form1
Inherits System.Windows.Forms.Form
Dim MyConn As String
Dim Str As String
Dim DB As OleDb.OleDbDataAdapter
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.Button1 = New System.Windows.Forms.Button
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(24, 32)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(248, 112)
Me.DataGrid1.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(112, 192)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(72, 40)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.DataGrid1)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As Sy stem.EventArgs) Handles Button1.Click
MyConn = "provider=microsoft.jet.oledb.4.0;data source =happy.mdb"
Dim Conn As New OleDb.OleDbConnection(MyConn)
Conn.Open()
Str = "select * from sc"
DB = New OleDb.OleDbDataAdapter(MyConn, Str)
Dim Rs As DataSet = New DataSet
db.Fill(Rs)
Conn.Close()
DataGrid1.DataSource = Rs
End Sub
这段代码有错没有呀?????
为什么运行就说是
未处理的“System.ArgumentException”类型的异常出现在 system.data.dll 中。
其他信息: 从索引 0 处开始,初始化字符串的格式不符合规范。
这个错误,高人急救啊!!!
Inherits System.Windows.Forms.Form
Dim MyConn As String
Dim Str As String
Dim DB As OleDb.OleDbDataAdapter
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.Button1 = New System.Windows.Forms.Button
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(24, 32)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(248, 112)
Me.DataGrid1.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(112, 192)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(72, 40)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.DataGrid1)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As Sy stem.EventArgs) Handles Button1.Click
MyConn = "provider=microsoft.jet.oledb.4.0;data source =happy.mdb"
Dim Conn As New OleDb.OleDbConnection(MyConn)
Conn.Open()
Str = "select * from sc"
DB = New OleDb.OleDbDataAdapter(MyConn, Str)
Dim Rs As DataSet = New DataSet
db.Fill(Rs)
Conn.Close()
DataGrid1.DataSource = Rs
End Sub
这段代码有错没有呀?????
为什么运行就说是
未处理的“System.ArgumentException”类型的异常出现在 system.data.dll 中。
其他信息: 从索引 0 处开始,初始化字符串的格式不符合规范。
这个错误,高人急救啊!!!