Dataset.Fill hanging

nabbyg

Member
Joined
May 10, 2005
Messages
16
Programming Experience
1-3
Hello Everybody,

I have been struggling with the DataAdapter for a couple of days now...I dont knwo why, but everytime I try to fill the dataset, the process just hangs. I including the code at the bottom. I am using the MySql .NET connector.

I tried the same query in the MySql manager and the same query worked fine and returned the expected results.

I tried to use a datareader on this as well but then datareader keeps getting a "Connection must be valid or Open" error.

Has anybody come across this before and do you have any suggestions.
I am inclusind the code at the bottom... is anybody is interested.

Thanks,
Nabby

VB.NET:
[size=2][color=#008000]'check what kind of report has to be generated
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Type [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String[/color][/size][size=2] = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].ReportType.SelectedItem.Text
 
[/size][size=2][color=#008000]'grab the month and the year and create a datestring
 
[/color][/size][size=2][color=#008000]'this date string will be used in all the report queries
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] datelower [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] dateupper [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String
 
[/color][/size][size=2][color=#0000ff]If[/color][/size][size=2][color=#0000ff]Me[/color][/size][size=2].MonthList.SelectedItem.Value = "AllYear" [/size][size=2][color=#0000ff]Then
 
[/color][/size][size=2]datelower = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].yearlist.SelectedItem.Value + "-01-01 12:00:00 AM"
 
dateupper = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].yearlist.SelectedItem.Value + "-12-31 11:59:59 PM"
 
[/size][size=2][color=#0000ff]Else
 
[/color][/size][size=2]datelower = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].yearlist.SelectedItem.Value + "-" + [/size][size=2][color=#0000ff]Me[/color][/size][size=2].MonthList.SelectedItem.Value + "-01 12:00:00 AM"
 
dateupper = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].yearlist.SelectedItem.Value + "-" + [/size][size=2][color=#0000ff]Me[/color][/size][size=2].MonthList.SelectedItem.Value + "-31 11:59:59 PM"
 
[/size][size=2][color=#008000]' datelower = CType(datelower, Date)
 
[/color][/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]If
 
[/color][/size]
Dim connectionstring As String = "Server=192.168.1.111;Database=test;Uid=root;Pwd=1Password;"
 
Dim downloader As String
 
Dim ds As New DataSet
 
Dim sql As String = "Select count(u.userid),business from downloads d,userlogin u where (u.userid = d.userid) and (d.date between'" & datelower & "' and '" & dateupper & "') group by business order by 1 DESC LIMIT 0,2"
 
 
 
Dim da As New MySqlDataAdapter(sql, connectionstring)
 
Dim ddr As DataRow
 
da.Fill(ds, "tabletest")
 
Me.NumberLogins.Text = "The Top Downloaders for the Month and the Year selected are <br>"
 
For Each ddr In ds.Tables("tabletest").Rows
 
downloader = ddr("Business") & " " & ddr.Item(0) & "<br>"
 
Next
 
Back
Top