Datalist

RPBLEA

Active member
Joined
Apr 26, 2005
Messages
36
Programming Experience
1-3
I'm having trouble loading data into a Data LIst, I've never done it before and have no idea how to do it, I'm thinking it is very similiar to a DataGrid, Can someone take a look at my code and see what's wrong?

Stored Procedure
CREATE procedure dbo.searchtest
@searchword as varchar(15),
@searchword2 as varchar(10)
as
select *
from networktbl1
where comments Like '%' + @searchword + ' %' or jack like '%' + @searchword2 + '%'
GO



Sub loaddatalist()

Dim searchboth As String

searchboth = txtsearchcomments.Text & txtsearchjack.Text

Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("strDBConn"))

Try

conn.Open()

Dim cmd As New SqlCommand("searchcomments", conn)

cmd.CommandType = CommandType.StoredProcedure

cmd.Parameters.Add("@searchword", txtsearchcomments.Text)

Dim myAdapter As New SqlDataAdapter(cmd)

Dim ds As New DataSet

myAdapter.Fill(ds)

ddlsearch.DataSource = ds

ddlsearch.DataBind()

Catch ex As Exception

lblerr.Text = ex.Message

End Try

conn.Close()

End Sub

 
Top Bottom