Query on datagrid problem

Steven Low

Active member
Joined
Apr 14, 2005
Messages
42
Programming Experience
1-3
Hi Guys Im having problem with filling the datagrid in vb.net

I like to put my Query table which has the below
tabes and query into the datagrid in vb.net but i keep getting the message that it does not like the replace word the message it displays is
undefined function "replace"


Need help on this guys:(

SELECT student.StudentID, student.Firstname, student.Lastname, student.Age, student.[Dance Stage], student.Attendence, student.tname, Len(Replace([Attendence],"x","")) AS totalattendence
FROM student;


Heres what ive done in my vb.net

Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim connStr As String = "Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\\proj.mdb;"

Dim sqlStr = "Select * From Query2 WHERE tname LIKE '*" & lb1.Text & "*'"

Debug.WriteLine(sqlStr)
Dim oledbstudent As New OleDb.OleDbDataAdapter(sqlStr, connStr)
Dim connection As New OleDb.OleDbConnection(connStr)
Dim oDataTable As New DataTable

Try
oledbstudent.Fill(oDataTable) 'Keept highlighting this
dg1.DataSource = oDataTable
Catch ex As OleDbException
' Messagbox.Show(ex.Message)
MessageBox.Show(ex.Message)
End Try

 
Back
Top