我把代码贴出来了,各位看一下是哪错了???If Not IsPostBack Then
            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.DataBind()
            DropDownList1.DataTextField = "authername"
            DropDownList1.DataValueField = "pid"
            conn.Close()
        End If

解决方案 »

  1.   


                DropDownList1.DataTextField = "authername"
                DropDownList1.DataValueField = "pid"
    DropDownList1.DataBind()
    你搞反了。
      

  2.   

    好的,谢谢 wht6411,但又出现了一个问题,就是我的表里面有好几个一样的authername,它们都在dropdownlist里面显示出来了,我想让它只显示一个,怎么办呢???
      

  3.   

    astr = "select distinct authername from picture"
      

  4.   

    astr = "select authername from picture"->astr = "select distinct authername,pid from picture"
      

  5.   

    TO:DropDownList1.DataValueField = "pid"你都没有把pid查出来,怎么绑定?
      

  6.   

    select distinct authername,pid from picture