Friday, March 30, 2012

problem in filling a dataset using dataAdapter

hi friends,

i look forward an answer that solves my problem.

iam trying too populate a DropDown list . here is the codings. Previously it was working. suddenly,

it s generating error.

strConnectionString = "Provider = SQLOLEDB;Integrated Security=False; User ID=sa;Password=;Data Source=GIREESH-AC720F7;Initial Catalog=NorthWind"

in page_load event

dim sql as string

sql = "select AthleteNameKey from athletes"

result_adap = DbAccess.ExecuteAdaP(sql)

result_adap.Fill(result_ds, "athletes")

cboAthleteName.DataSource = "athletes"

cboAthleteName.DataTextField = "AthleteNameKey"

cboAthleteName.DataValueField = "AthleteNameKey"

cboAthleteName.DataBind()

PublicFunction ExecuteAdaP(ByVal sqlsAsString)As OleDbDataAdapter

'Dim ds As New OleDbDataAdapter

Dim daAsNew OleDbDataAdapter(sqls, strConnectionString)'da.Fill(ds)Return da

EndFunction

What's the detailed error message? When the error occurs, can you do the same query using Query Analyzer?

No comments:

Post a Comment