| |

VerySource

 Forgot password?
 Register
Search
View: 2114|Reply: 9

DROPDOWNLIST is bound to not data, only display system.data.DataRowView

[Copy link]

1

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-4-22 15:30:01
| Show all posts |Read mode
I put the code out, and I saw it wrong.??

IF not ispostback.
            DIM Astr As String
            astr = "Select AutherName from Picture"
            DIM CMD1 AS New Sqlcommand (Astr, Conn)
            Conn.open ()
            DIM ADP AS New SqldataAdapter (cmd1)
            DIM DS AS New DataSet
            ADP.FILL (DS, "Picture")
            DROPDOWNLIST1.DATASOURCE = ds.tables (0) .defaultView
            DropDownList1.Database
            DropdownList1.DataTextField = "Authername"
            DROPDOWNLIST1.DATAVALUEFIELD = "PID"
            CONN.CLOSE ()
        END IF
Reply

Use magic Report

1

Threads

18

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2021-4-22 15:45:01
| Show all posts
DropdownList1.DataTextField = "Authername"
            DROPDOWNLIST1.DATAVALUEFIELD = "PID"
DropDownList1.Database
You are going back.
Reply

Use magic Report

1

Threads

18

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2021-4-22 16:00:01
| Show all posts
Post DataBind, first specify text and value
Reply

Use magic Report

1

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2021-4-22 16:15:01
| Show all posts
Thank you, I will try it.
Reply

Use magic Report

1

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2021-4-22 18:00:01
| Show all posts
Ok, thank you\, but there is a problem, it is a few as a few Authername in my table, which is displayed in DropDownList, I want it to display only one, what??????????
Reply

Use magic Report

0

Threads

15

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 Japan

Post time: 2021-4-22 18:45:01
| Show all posts
astr = "Select Distinct Authername from Picture"
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2021-4-22 19:00:01
| Show all posts
astr = "Select AutherName from Picture"

->

Astr = "Select Distinct Authername, Pid from Picture"
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2021-4-22 19:15:01
| Show all posts
TO: DROPDOWNLIST1.DATAVALUEFIELD = "PID"

You didn't find the PID, how to bind?
Reply

Use magic Report

0

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2021-4-22 19:30:01
| Show all posts
Select Distinct Authername, PID from Picture
Reply

Use magic Report

1

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2021-4-22 20:15:02
| Show all posts
Everything is OK, thank you ~ `
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list