TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
varun
NA
12
14.8k
Binding Data to Combobox Using Stored Procedure
Dec 21 2012 1:02 AM
Hi,
I am Trying to Bind the data from data from database to combobox using a stored procedure. I am getting an Error saying:
InvalidOperationException
Fill: SelectCommand.Connection property has not been initialized.
Here is my code:
DataTable dtTest = new DataTable();
SqlConnection con=new SqlConnection(Helper.ConnectionString);
con.Open();
SqlCommand cmd=new SqlCommand();
cmd.CommandText="GetTopInvoiceId";
cmd.CommandType=CommandType.StoredProcedure;
SqlDataAdapter sdaTest = new SqlDataAdapter(cmd);
DataSet dsTest=new DataSet();
sdaTest.Fill(dsTest);
cmbTest.DataSource = dsTest.Tables[0];
con.Close();
Any suggestions Pls...
Reply
Answers (
5
)
interview question
Please Insert Upload Button And Delete Button To Blog