DataGridView (HELP)

panjul

Member
Joined
Jun 7, 2007
Messages
21
Programming Experience
Beginner
Guys, this is my code to show my database in datagridview, my database using sql server, and i'm using ODBC and udl.

Dim mdlb As New MdlDB
Dim sql As New SQL
Dim query As String = sql.SetSELECT("Title", "news")


Dim ds As New DataSet
Dim dv As New DataView
ds = sql.FillDataSet(query, Label1.Text)
dv.Table = ds.Tables(0)

DataGridView1.DataSource = dv

but i can't appear in my datagridview. AnyBody can help me ??PLS..:confused:
 
There is no pojnt to your DataView. Just do this:
VB.NET:
Expand Collapse Copy
DataGridView1.DataSource = ds.Tables(0)
Assuming that your SQL class does what it's supposed to then that will work.

That said, you should use a BindingSource between your DataTable and your control(s).
 
I believe that you replace your connection string with the path of the UDL file, e.g.
VB.NET:
Expand Collapse Copy
Dim connection As New OdbcConnection("File Name=C:\MyFile.udl")
 
nope i didn't do that.I know if we do by click file .udl using notepad, but i want the program read the udl for connection string
 
Back
Top