I'm working with a ItemDataBound event for a datagrid, but getting the error "Type 'SqlDataAdapter' is not defined." in the process. Could someone please help me in understanding why the error is occuring? Thanks.
--
Mike
Code:
Public Class LogsList
Inherits System.Web.UI.Page
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
Handles DataGrid1.ItemDataBound
If e.Item.ItemType = ListItemType.EditItem Then
Dim DRV As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim Specie As String = DRV("SpecieID")
Dim DDL As DropDownList = _
CType(e.Item.Cells(4).Controls(1), DropDownList)
Dim SQL As String = _
"SELECT SpecieID, Specie FROM lkup_Specie ORDER BY SpecieID"
[COLOR=green][b]Dim DA As [u]SqlDataAdapter[/u] = New SqlDataAdapter(SQL, ConnStr)[/b][/color]
Dim DS As New DataSet
Dim item As ListItem
DA.Fill(DS, "lkup_Specie")
DDL.DataSource = DS.Tables("lkup_Specie").DefaultView
DDL.DataTextField = "Specie"
DDL.DataValueField = "SpecieID"
DDL.DataBind()
item = DDL.Items.FindByValue(Specie)
If Not item Is Nothing Then item.Selected = True
End If
End Sub
--
Mike