高手!万事具备之欠东风···
当我运行查询时第一次可以查询,当我要查选第二个时会跳出这种窗口。。想请各位大哥帮帮小弟。。sqlCmd.CommandText = "select 名称 ,尺寸 ,颜色,价格,数量 from 库存表 where 名称=@ShoesID and 尺寸=@NoID and 颜色=@ColorID"
sqlCmd.Parameters.Add("@shoesID", SqlDbType.VarChar)
sqlCmd.Parameters("@shoesID").Value = Me.txtShoesID.Text
sqlCmd.Parameters.Add("@noID", SqlDbType.Int)
sqlCmd.Parameters("@noID").Value = Me.CombNoID.Text
sqlCmd.Parameters.Add("@colorID", SqlDbType.VarChar)
sqlCmd.Parameters("@colorID").Value = Me.combColorID.SelectedItem
sqlCmd.Connection = Module1.sqlconn
sqlDa.SelectCommand = sqlCmd
' Module1.sqlconn.Close()
Dim sqlDr As SqlDataReader
Try
If Module1.sqlconn.State <> ConnectionState.Open Then
Module1.sqlconn.Open()
End If
sqlDr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection)
If sqlDr.Read Then
Me.txtUnitPrice.Text = sqlDr("价格")
Me.txtStockQuantity.Text = sqlDr("数量")
End If
sqlDr.Close()
Module1.sqlconn.Close()
Catch ex As Exception
MsgBox("发生错误:" & ex.Message)
End Try