0
我可以在如何從數據庫檢索記錄的工作示例中選擇下拉列表後填充相關文本框。我有什麼是絕對不工作&即時通訊工作VS 2008。任何人都可以告訴我的方式?從下拉列表中選擇後,從SQL查詢中填充文本框
我有:
Dim myConn As New SqlConnection
Dim myCmd As New SqlCommand
Dim dtrReader As SqlDataReader
myConn.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
myCmd = myConn.CreateCommand
myCmd.CommandText = "SELECT * FROM Product WHERE product_id = '" & DropDownList2.Text & "'"
'myCmd.CommandType = CommandType.Text
'populate controls from DB
'myCmd.Parameters.Add(New SqlParameter("@product_id", a))
myCmd.Parameters.Add(New SqlParameter("@product_name", (txtProductName2.Text)))
myCmd.Parameters.Add(New SqlParameter("@product_title", txtProductTitle2.Text))
myCmd.Parameters.Add(New SqlParameter("@product_desc", txtProductDescription2.Text))
myCmd.Parameters.Add(New SqlParameter("@product_author", txtProductAuthor2.Text))
mycmd.Dispose()
myConn.Close()
myConn.Dispose()
就是這樣!非常感謝! :) – brainsfrying 2012-01-01 08:05:39