Strange behaviour Datagrid

alaric

Well-known member
Joined
Oct 12, 2005
Messages
53
Programming Experience
Beginner
[RESOLVED] Strange behaviour Datagrid

Hi

i have a form with a datagrid on wich a user can select a row. below this grid I show the detail in textboxes.
these texboxes are displayed on a tabcontrol.

this Tabcontrol does also have a second tab. On this Itab want to display additional info of the selected row.
so far so good.
when using this sql query
VB.NET:
[SIZE=2]
daCursFin = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SqlClient.SqlDataAdapter("SELECT LesGeld, Betaald, Betaaldatum, CurStudentenKorting, CurACardKorting," _
& " CurAanbrengkorting, CurOverigeKorting, Locatie, Weekdag, DatumBetAangemaakt, TBetalingen.BetalingsKenmerk" _
& " FROM TBetalingen INNER JOIN TInschrijving ON TBetalingen.Inschrijvingsid = TInschrijving.InschrijvingsID" _
& " WHERE CursistId = '" & strCursistID & "'", strCnn)
[/SIZE]

it goes wrong (when i use a query tool there are results!)
The dg is empty.

but when i use
VB.NET:
[SIZE=2]
daCursFin = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SqlClient.SqlDataAdapter("SELECT LesGeld, Betaald, Betaaldatum, CurStudentenKorting, CurACardKorting," _
& " CurAanbrengkorting, CurOverigeKorting, Locatie, Weekdag, DatumBetAangemaakt, TBetalingen.BetalingsKenmerk" _
& " FROM TBetalingen " _
& " WHERE CursistId = '" & strCursistID & "'", strCnn)
[/SIZE]

then the result are shown in the dg as I expect.

The difference is the Join. but is this the problem.
I'm out and confused

someone, any ideas?
thx
 
Last edited:
I doubt that this has anything to do with the DataGrid. If it's not displaying any data then I'd guess that there is no data to display. Have you confirmed that your query returns any records? Note that the Fill method is not a procedure. It is a Function that returns the number of rows retrieved by the query. You can use that return value if and how you want, e.g.
VB.NET:
MessageBox.Show("Query returned this many rows: " & myDataAdapter.Fill(myTable).ToString())
or else you can check the Rows.Count property of the DataTable.
 
thx jmcilhinney!

dont know where my brains went wrong. But with your methode I found that the query result was empty. I reformatted the query.... with a postive result!. tanks for ging me the tought.
 
Back
Top