Asp.net 如何使用DropDownList读取SQL行并在textbox上传递值来处理事件?

Asp.net 如何使用DropDownList读取SQL行并在textbox上传递值来处理事件?,asp.net,sql-server,vb.net,winforms,visual-studio-2013,Asp.net,Sql Server,Vb.net,Winforms,Visual Studio 2013,当我在DevExpress的下拉列表中选择一个值时,如何在文本框中传递数据表或行(SQL) 更具体地说: 当我在DropDownList(DevExpress控件)[例如“Countries”]上单击1个值时,我选择“USA”,在其他控件(本例中为文本框)中,它会自动显示文本值“Washington DC”(从同一SQL数据表中读取) 是在Visual Studio 2013 ASPX.NET VB(Winforms)中编程dropdownlist的单击事件,并使用您选择的like查询参数值 T

当我在DevExpress的下拉列表中选择一个值时,如何在文本框中传递数据表或行(SQL)

更具体地说:

当我在DropDownList(DevExpress控件)[例如“Countries”]上单击1个值时,我选择“USA”,在其他控件(本例中为文本框)中,它会自动显示文本值“Washington DC”(从同一SQL数据表中读取)


是在Visual Studio 2013 ASPX.NET VB(Winforms)中编程dropdownlist的单击事件,并使用您选择的like查询参数值

Try
    Using cnn As New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=C:\My Documents\Bd1.mdb")

        'Create a comand
        Dim cmd As OleDbCommand = cnn.CreateCommand()

        'Indicates the query you will execute
        cmd.CommandText = _
            "SELECT SUM(name field) AS Suma FROM NameTable"

        'Open the connection
        cnn.Open()

        'Execute the query
        Dim suma As Object = cmd.ExecuteScalar()

        ' Show the formatted result in control TextBox
        TextBox1.Text = String.Format("{0:N2}", suma)

    End Using

Catch ex As Exception
    MessageBox.Show(ex.Message)

End Try

与论坛网站不同,我们不使用“感谢”或“感谢任何帮助”或签名。见”。