473,385 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How To? Bind MS Access to DropDownList?

I am sure this must be about the simplest thing to do. I can whip
something off in 10 different languages and environments with no
problem. But VisualStudio 2003 and ASP.NET is sooooo frustrating!!!

My example is simple. I have an Access table (mytable) with two fields
of type text (userid and password).

I want to display a dropdownlist on a page and have it list the
userids. Nothing more.

Since VisualStudio is a little more graphical than, say, notepad, I
want to take advantage of drag and drop programming.

I create my database connection in the server panel.
I add an OleDbConnection, OleDbDataAdapter and DataSet (not sure if
this is right but it seemed like I was being lead in that direction).

Next I drop a dropdownlist on the form. Goto properties and set
DataSource = DataSet11
DataMember = mytable
DataTextField = userid
DataValueField = userid

Build and view and I get a nice white page with an empty dropdown list
sitting on it. Tried addind DataBind() to the page_load and still
nothing.

Tried searching help/gotdotnet/msdn/etc and find plenty of examples on
databinding to arraylists and other datasource types but nothing that
helps me out. Some examples I didn't try but they involved 20-30 lines
of code. Surely it doesn't take that much code now, in a drag and drop
IDE, to do what we could do in ASP.Classic and notepad in 4 lines?

Please help, or better yet point me to a resource that so far has
eluded by many Google attempts?

Thanks,

T

Nov 19 '05 #1
3 1954
add db connection
add data adapter
create dataset from data adapter
set dataset as datasource, and set datatextfield and datavaluefield

switch to Page_Load event handler

call dataadapter.Fill(dataset)
call dropdownlist.DataBind()

cheers

tr**********@gmail.com wrote:
I am sure this must be about the simplest thing to do. I can whip
something off in 10 different languages and environments with no
problem. But VisualStudio 2003 and ASP.NET is sooooo frustrating!!!

My example is simple. I have an Access table (mytable) with two fields
of type text (userid and password).

I want to display a dropdownlist on a page and have it list the
userids. Nothing more.

Since VisualStudio is a little more graphical than, say, notepad, I
want to take advantage of drag and drop programming.

I create my database connection in the server panel.
I add an OleDbConnection, OleDbDataAdapter and DataSet (not sure if
this is right but it seemed like I was being lead in that direction).

Next I drop a dropdownlist on the form. Goto properties and set
DataSource = DataSet11
DataMember = mytable
DataTextField = userid
DataValueField = userid

Build and view and I get a nice white page with an empty dropdown list
sitting on it. Tried addind DataBind() to the page_load and still
nothing.

Tried searching help/gotdotnet/msdn/etc and find plenty of examples on
databinding to arraylists and other datasource types but nothing that
helps me out. Some examples I didn't try but they involved 20-30 lines
of code. Surely it doesn't take that much code now, in a drag and drop
IDE, to do what we could do in ASP.Classic and notepad in 4 lines?

Please help, or better yet point me to a resource that so far has
eluded by many Google attempts?

Thanks,

T


Nov 19 '05 #2
<<I can whip something off in 10 different languages and environments with
no problem>>

You must be amazing! I didn't know there were 10 different languages AND
environments. What are they? Apparently NONE of them are .NET languages or
Visual Studio because that's where you're having trouble. Can you just
provide a simple list of what they are? All 10 of them? Or even 5 of them.
That would be great to know.

(really curious here!)

Thanks!

-F
<tr**********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
I am sure this must be about the simplest thing to do. I can whip
something off in 10 different languages and environments with no
problem. But VisualStudio 2003 and ASP.NET is sooooo frustrating!!!

My example is simple. I have an Access table (mytable) with two fields
of type text (userid and password).

I want to display a dropdownlist on a page and have it list the
userids. Nothing more.

Since VisualStudio is a little more graphical than, say, notepad, I
want to take advantage of drag and drop programming.

I create my database connection in the server panel.
I add an OleDbConnection, OleDbDataAdapter and DataSet (not sure if
this is right but it seemed like I was being lead in that direction).

Next I drop a dropdownlist on the form. Goto properties and set
DataSource = DataSet11
DataMember = mytable
DataTextField = userid
DataValueField = userid

Build and view and I get a nice white page with an empty dropdown list
sitting on it. Tried addind DataBind() to the page_load and still
nothing.

Tried searching help/gotdotnet/msdn/etc and find plenty of examples on
databinding to arraylists and other datasource types but nothing that
helps me out. Some examples I didn't try but they involved 20-30 lines
of code. Surely it doesn't take that much code now, in a drag and drop
IDE, to do what we could do in ASP.Classic and notepad in 4 lines?

Please help, or better yet point me to a resource that so far has
eluded by many Google attempts?

Thanks,

T

Nov 19 '05 #3
LOL
"Frankie" <Be***********@TacoTime.net> wrote in message
news:uZ**************@TK2MSFTNGP15.phx.gbl...
<<I can whip something off in 10 different languages and environments with
no problem>>

You must be amazing! I didn't know there were 10 different languages AND
environments. What are they? Apparently NONE of them are .NET languages or
Visual Studio because that's where you're having trouble. Can you just
provide a simple list of what they are? All 10 of them? Or even 5 of them.
That would be great to know.

(really curious here!)

Thanks!

-F
<tr**********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
I am sure this must be about the simplest thing to do. I can whip
something off in 10 different languages and environments with no
problem. But VisualStudio 2003 and ASP.NET is sooooo frustrating!!!

My example is simple. I have an Access table (mytable) with two fields
of type text (userid and password).

I want to display a dropdownlist on a page and have it list the
userids. Nothing more.

Since VisualStudio is a little more graphical than, say, notepad, I
want to take advantage of drag and drop programming.

I create my database connection in the server panel.
I add an OleDbConnection, OleDbDataAdapter and DataSet (not sure if
this is right but it seemed like I was being lead in that direction).

Next I drop a dropdownlist on the form. Goto properties and set
DataSource = DataSet11
DataMember = mytable
DataTextField = userid
DataValueField = userid

Build and view and I get a nice white page with an empty dropdown list
sitting on it. Tried addind DataBind() to the page_load and still
nothing.

Tried searching help/gotdotnet/msdn/etc and find plenty of examples on
databinding to arraylists and other datasource types but nothing that
helps me out. Some examples I didn't try but they involved 20-30 lines
of code. Surely it doesn't take that much code now, in a drag and drop
IDE, to do what we could do in ASP.Classic and notepad in 4 lines?

Please help, or better yet point me to a resource that so far has
eluded by many Google attempts?

Thanks,

T


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Carlos | last post by:
I have a dropdown list that binds data from a data reader bo I have a second dropdown list in my wen form which I want to have same data, how can I copy the one is bind to a secopnd one.. see my...
2
by: COHENMARVIN | last post by:
I'm leafing through a big book on asp.net, and I don't see any way to the following: 1. bind values and text to a dropdown 2. Also make the first line of the dropdown say something different. For...
1
by: mr2_93 | last post by:
Hi All, I am new to ASP.NET and I am looking for help with the dropdownlist data control. I wonder if someone could show me how to past the SelectedValue of a data-bind dropdownlist to...
1
by: Patrik Zdarsa | last post by:
Hi, I'm try VS 2005 and need UPDATE database record in viewform, all working when every filed is type TextBox (html INPUT) but I need change one TextBox to Listbox or dropdownlist and read data...
3
by: sck10 | last post by:
Hello, I am trying to bind an arraylist to a FormView DropDownList control in the PreRender state. The error that I get is the following: Databinding methods such as Eval(), XPath(), and...
0
by: Mark Micallef | last post by:
Hi, I'm having a problem using a databound dropdownlist inside a reorderlist ajax control. Here's a snippet of the code I'm using: <InsertItemTemplate> <div class="insertArea">...
1
by: Mark Micallef | last post by:
Hi, this question relates to a control in the Ajax toolkit for asp.net 2. I'm having a problem using a databound dropdownlist inside a reorderlist ajax control. Here's a snippet of the code I'm...
1
by: iswar | last post by:
Hi friends.. Im trying to bind a value from dropdownlist placed in gird view to another cell. i want to update a database field with the selected value from dropdownlist and which must be bind to...
1
by: sweatha | last post by:
Hi Friends I have designed a form with 1 DropDownList box named “ddlShow_time”& the form name is “Default4.aspx”. Just like that, I have the database(SQL SERVER 2000) as Table Name: ShowTime...
2
by: akshalika | last post by:
Hi, I have a repeater control. it dynamically bind textbox or dropdown base on some condition. i want to bind required field validator dynamically for validate textbox or dropdown. here is my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.