在一个表中查询出我要查询的机械来,比如集装箱,查出来有很多,那么如何才能统计它们的数量呢?
是用count函数吗?我下边的代码那里错了??它说 temp = reader.GetInt32(cs)有错误,请帮帮我,谢谢!!!
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       
        Dim myconnection As SqlConnection        myconnection = New SqlConnection("Data Source=(local);Uid=sa;pwd=sa;DataBase=tzgl")
        Dim cs As String
        cs = "select count(jxmc)  from jxzk"
        Dim selectcommand As SqlCommand = New SqlCommand(cs, myconnection)
        Dim reader As SqlDataReader
        Dim temp As String
        myconnection.Open()
        reader = selectcommand.ExecuteReader()
        If (reader.Read()) Then
            temp = reader.GetInt32(cs)
            TextBox2.Text = temp
            reader.Close()
            myconnection.Close()
        End If
    End Sub