vb6编个小事例 怎样连接sql数据苦 新手请达人指点.
'请老师帮忙我这前面要加什么代码怎么连上SQL数据库, 比如数据苦ip:192.168.0.23 用户名:sa 密码:123
'还有P4这段SQL语句为什么不执行?
'谢谢!
Private Sub Command1_Click()
Dim p(0) As String
p1 = Text1.Text '输入的是起始日期2012-11-12
p2 = Text2.Text '输入的是结事日期2012-11-13
p3 = Text4.Text '输入的是站号比如 11
p4 = "select count(send) from dbo.t_water_data where send=p3 between p1 and p2 order by time desc" '查询这12号到13号数招库里一共有多少条数据
p5 = 288 - p4
If p5 <> 0 Then
Text3.Text = p5
Else
Text3.Text = "恭喜您此站点不缺数!"
End If
End Sub
[最优解释]
p4 = "select count(send) as i from dbo.t_water_data where send='"& p3 &"' and [time] between '"& p1 &"' and '"& p2 &"'"
[其他解释]
http://download.csdn.net/detail/veron_04/1627068
[其他解释]