0
Dim connection As OleDbConnection
        connection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " _
       & "Data Source=" & Server.MapPath("~/Database/dbLupon.mdb") & ";")
        
        Dim command As OleDbCommand
        Dim commandPos As OleDbCommand
        
        commandPos = New OleDbCommand("Select POSITION_C FROM tblLupon_C WHERE POSITION = 'C' REGION_C = '" & lblRegion_C.Text & "' AND PROVINCE_C = '" & lblProvince_C.Text & "' AND CITYMUN_C = '" & cmbCityMun.SelectedValue & "' AND BARANGAY_C = '" & cmbBarangay.SelectedValue & "'")
        connection.Open()
        Dim DataReader As OleDbDataReader
        DataReader = commandPos.ExecuteReader()
        If GridView1.Rows.Count = 0 Then
            MsgBox("AKO!")
        Else
            While DataReader.Read
                MsgBox("duPLICATE")
            End While
        End If

Hi guys, I'm having a problem regarding duplicate data in the gridview.. I need one chairman on the record. thanks! :D

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by __avd
0

sir, the return error was

Executereader: COnnection property has not been initialized..

I used the code to validate that if there is a Chairman position in the data, it will not be accepted because it should have one chairman per barangay.

thanks sir :D

0

Command's Connection property is not set.

commandPos = New OleDbCommand("Select DISTINCT POSITION_C FROM tblLupon_C WHERE POSITION = 'C' REGION_C = '" & lblRegion_C.Text & "' AND PROVINCE_C = '" & lblProvince_C.Text & "' AND CITYMUN_C = '" & cmbCityMun.SelectedValue & "' AND BARANGAY_C = '" & cmbBarangay.SelectedValue & "'")
[I]commandPos.Connection=connection[/I]

connection.Open()
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.