Hello!
I am trying to populate a gridview in my asp.net webform with average scores retrieved from my database.
The code i have written so far is as follows....
Dim Count As Integer
Dim myBM As String
Con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = ../SR.mdb"
sql = "Select Distinct BMno From Skills"
DShold = StatDC.SelectData(sql, con)
Count = DShold.Tables(0).Rows.Count
Count = Count - 1
Do While Count >= 0
myBM = Convert.ToString(DShold.Tables(0).Rows(Count)("BMno"))
sql = "SELECT Avg(Competence) AS CompetenceAvg" _
& " FROM Skills" _
& " Where BMno = BM401582"
DSstat = StatDC.SelectData(sql, con)
Count = Count - 1
Loop
gv1.DataSource = DSstat
gv1.DataBind()
My problem is that it doesnt like the SQL staement Select AVG(competennce)..... I have run the query in access and it runs fine?
Also i would like to add the record returned to the dataset DSstat i think how i have got it at the minute will just replace the contents of the dataset with the results of the query. so how would i add a record?
I hope that i have made some kind of sense!
Thanks for looking and any help!!
Iain
I am trying to populate a gridview in my asp.net webform with average scores retrieved from my database.
The code i have written so far is as follows....
Dim Count As Integer
Dim myBM As String
Con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = ../SR.mdb"
sql = "Select Distinct BMno From Skills"
DShold = StatDC.SelectData(sql, con)
Count = DShold.Tables(0).Rows.Count
Count = Count - 1
Do While Count >= 0
myBM = Convert.ToString(DShold.Tables(0).Rows(Count)("BMno"))
sql = "SELECT Avg(Competence) AS CompetenceAvg" _
& " FROM Skills" _
& " Where BMno = BM401582"
DSstat = StatDC.SelectData(sql, con)
Count = Count - 1
Loop
gv1.DataSource = DSstat
gv1.DataBind()
My problem is that it doesnt like the SQL staement Select AVG(competennce)..... I have run the query in access and it runs fine?
Also i would like to add the record returned to the dataset DSstat i think how i have got it at the minute will just replace the contents of the dataset with the results of the query. so how would i add a record?
I hope that i have made some kind of sense!
Thanks for looking and any help!!
Iain