在一个表中查询出我要查询的机械来,比如集装箱,查出来有很多,那么如何才能统计它们的数量呢?
是用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
是用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
解决方案 »
- ASP.net的TextBox问题
- 用C#做asp.net与C#用做应用程序的区别都有那些?
- |zyciis|200分求 谁能告诉我taobao和paipai查询的排序方式是哪一个关键字 谢谢 急
- 自定义server控件和自带的server控件,效率问题请教,有经验者进。
- 看看我的论坛,完美仿Discuz
- 如何读取指定地址图片数据流
- 大家怎样把用户通过aspx的请求的参数传递到一个桌面应用程序中,然后再返回给用户啊?其间用户需要等待.
- 请高手指导(Connection timeout提示),解决后立即给分!急!急!急!
- 请问:如何在webform页面上,一按回车就自动提交了,请问怎么转化成一回车光标就移到下一个TextBox文本框?
- 初学者求助,程序跳转失败
- !!!!抢分了。菜手求救,关于模拟Cookie,抓取页面。
- asp.net中创建一个进程的问题
用这个ExecuteScalar