无法绑定到 属性 IN VB.NET
Cannot bind to the property IN VB.NET
我有一个问题无法绑定 属性。
或者因为我的 code.Please 解决方案有问题。
我正在使用 visual studio 2010.
Private Sub PopulateDataGridView()
Try
dt = New DataTable
Dim query = "select ITM,ITC,QOH,PRS,PRSOBBRT,PRSOBNET,FILENAME1,FILENAME2,FILENAME3,FILENAME4,FILENAME5,FILENAME6 FROM IFG WHERE QOH > 0 AND SHI = @SHI"
Using con As OleDbConnection = New OleDbConnection(cn)
Using cmd As OleDbCommand = New OleDbCommand(query, con)
cmd.Parameters.AddWithValue("@SHI", ComboBox1.SelectedValue)
Using adapter As New OleDbDataAdapter(cmd)
'Dim dt As DataTable = New DataTable()
adapter.Fill(dt)
Me.DataGridView1.DataSource = dt
End Using
End Using
End Using
ExPictureBox1.PrePath = Pathimage & "\"
ExPictureBox2.PrePath = Pathimage & "\"
ExPictureBox3.PrePath = Pathimage & "\"
ExPictureBox4.PrePath = Pathimage & "\"
ExPictureBox5.PrePath = Pathimage & "\"
ExPictureBox6.PrePath = Pathimage & "\"
ExPictureBox1.DataBindings.Add("FileName", dt, "FILENAME1")
ExPictureBox2.DataBindings.Add("FileName", dt, "FILENAME2")
ExPictureBox3.DataBindings.Add("FileName", dt, "FILENAME3")
ExPictureBox4.DataBindings.Add("FileName", dt, "FILENAME4")
ExPictureBox5.DataBindings.Add("FileName", dt, "FILENAME5")
ExPictureBox6.DataBindings.Add("FileName", dt, "FILENAME6")
Catch myerror As OleDbException
MessageBox.Show("Error: " & myerror.Message)
Finally
End Try
End Sub
谢谢罗伊
Private Sub PopulateDataGridView()
Try
dt = New DataTable
Dim query = "select ITM,ITC,QOH,PRS,PRSOBBRT,PRSOBNET,FILENAME1,FILENAME2,FILENAME3,FILENAME4,FILENAME5,FILENAME6 FROM IFG WHERE QOH > 0"
Using con As OleDbConnection = New OleDbConnection(cn)
Using cmd As OleDbCommand = New OleDbCommand(query, con)
Using adapter As New OleDbDataAdapter(cmd)
adapter.Fill(dt)
Me.DataGridView1.DataSource = dt
End Using
End Using
End Using
ExPictureBox1.PrePath = Pathimage & "\"
ExPictureBox2.PrePath = Pathimage & "\"
ExPictureBox3.PrePath = Pathimage & "\"
ExPictureBox4.PrePath = Pathimage & "\"
ExPictureBox5.PrePath = Pathimage & "\"
ExPictureBox6.PrePath = Pathimage & "\"
ExPictureBox1.DataBindings.Add("FileName", dt, "FILENAME1")
ExPictureBox2.DataBindings.Add("FileName", dt, "FILENAME2")
ExPictureBox3.DataBindings.Add("FileName", dt, "FILENAME3")
ExPictureBox4.DataBindings.Add("FileName", dt, "FILENAME4")
ExPictureBox5.DataBindings.Add("FileName", dt, "FILENAME5")
ExPictureBox6.DataBindings.Add("FileName", dt, "FILENAME6")
Catch myerror As OleDbException
MessageBox.Show("Error: " & myerror.Message)
Finally
End Try
End Sub
我有一个问题无法绑定 属性。 或者因为我的 code.Please 解决方案有问题。 我正在使用 visual studio 2010.
Private Sub PopulateDataGridView()
Try
dt = New DataTable
Dim query = "select ITM,ITC,QOH,PRS,PRSOBBRT,PRSOBNET,FILENAME1,FILENAME2,FILENAME3,FILENAME4,FILENAME5,FILENAME6 FROM IFG WHERE QOH > 0 AND SHI = @SHI"
Using con As OleDbConnection = New OleDbConnection(cn)
Using cmd As OleDbCommand = New OleDbCommand(query, con)
cmd.Parameters.AddWithValue("@SHI", ComboBox1.SelectedValue)
Using adapter As New OleDbDataAdapter(cmd)
'Dim dt As DataTable = New DataTable()
adapter.Fill(dt)
Me.DataGridView1.DataSource = dt
End Using
End Using
End Using
ExPictureBox1.PrePath = Pathimage & "\"
ExPictureBox2.PrePath = Pathimage & "\"
ExPictureBox3.PrePath = Pathimage & "\"
ExPictureBox4.PrePath = Pathimage & "\"
ExPictureBox5.PrePath = Pathimage & "\"
ExPictureBox6.PrePath = Pathimage & "\"
ExPictureBox1.DataBindings.Add("FileName", dt, "FILENAME1")
ExPictureBox2.DataBindings.Add("FileName", dt, "FILENAME2")
ExPictureBox3.DataBindings.Add("FileName", dt, "FILENAME3")
ExPictureBox4.DataBindings.Add("FileName", dt, "FILENAME4")
ExPictureBox5.DataBindings.Add("FileName", dt, "FILENAME5")
ExPictureBox6.DataBindings.Add("FileName", dt, "FILENAME6")
Catch myerror As OleDbException
MessageBox.Show("Error: " & myerror.Message)
Finally
End Try
End Sub
Private Sub PopulateDataGridView()
Try
dt = New DataTable
Dim query = "select ITM,ITC,QOH,PRS,PRSOBBRT,PRSOBNET,FILENAME1,FILENAME2,FILENAME3,FILENAME4,FILENAME5,FILENAME6 FROM IFG WHERE QOH > 0"
Using con As OleDbConnection = New OleDbConnection(cn)
Using cmd As OleDbCommand = New OleDbCommand(query, con)
Using adapter As New OleDbDataAdapter(cmd)
adapter.Fill(dt)
Me.DataGridView1.DataSource = dt
End Using
End Using
End Using
ExPictureBox1.PrePath = Pathimage & "\"
ExPictureBox2.PrePath = Pathimage & "\"
ExPictureBox3.PrePath = Pathimage & "\"
ExPictureBox4.PrePath = Pathimage & "\"
ExPictureBox5.PrePath = Pathimage & "\"
ExPictureBox6.PrePath = Pathimage & "\"
ExPictureBox1.DataBindings.Add("FileName", dt, "FILENAME1")
ExPictureBox2.DataBindings.Add("FileName", dt, "FILENAME2")
ExPictureBox3.DataBindings.Add("FileName", dt, "FILENAME3")
ExPictureBox4.DataBindings.Add("FileName", dt, "FILENAME4")
ExPictureBox5.DataBindings.Add("FileName", dt, "FILENAME5")
ExPictureBox6.DataBindings.Add("FileName", dt, "FILENAME6")
Catch myerror As OleDbException
MessageBox.Show("Error: " & myerror.Message)
Finally
End Try
End Sub