Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type 'SqlDataAdapter' is not defined.

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
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.

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
 
Add Imports System.Data.SqlClient to the top of the top of the .vb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top