i have an error when executing this
ExecuteReader: CommandText property has not been initialized
i have an error when executing this
ExecuteReader: CommandText property has not been initialized
pls reply as early
Error says that you haven't assign a SQL statement to the CommandText Property.
cmd.CommandText="put_sql_statement_here"
Show us your code please.
Imports System.Data
Imports System.Data.SqlClient
Dim dt As New DataTable
Dim objcon as new SqlConnection
Dim str as string= _
"data source=.\sqlexpress;attachdbfilename=|datadirectory|\database.mdf;integrated_
security=true;user instance=true;"
objcon.connectionstring=str
objcon.open()
Dim query as string="select * from user"
Dim da As new SqlDataAdapter(query,objcon)
da.fill(dt)
dropdownlist1.datasource=dt
dropdownlist1.datatextfield="field that you want"
dropdownlist1.databind()
objcon.close()
KOUROSH NIKZAD
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.