使用select在date = todays date中填充数据集 [英] fill data set using select where date= todays date
本文介绍了使用select在date = todays date中填充数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Dim data1 As String
Dim conn1 As SqlConnection
Dim cmd1 As New SqlCommand><<
Dim ada1 As New SqlDataAdapter()
Dim ds1 As New DataSet
data1 = lbldmdate.Text.ToString()
conn1 = New SqlConnection("Persist Security Info=false;User Id=justin;Data Source=ARULJUSTIN\SQLEXPRESS;Initial Catalog=firemaintain;Integrated Security=True;Pooling=False")
conn1.Open()
ada1 = New SqlDataAdapter("select Recordno, uhnumber,uhbuilding,uhlocation from hydrantmaintain WHERE unndate= '" & Today.ToString("dd/mm/yyyy") & "'", conn)
ada1.Fill(ds1)
dgnxtmdates.DataSource = ds1.Tables(0)
推荐答案
尝试修改查询,如下所示 -
Try modifying the Query like given below -
"select Recordno, uhnumber,uhbuilding,uhlocation from hydrantmaintain WHERE CONVERT(DATE,unndate)= '" & Today.ToString("yyyy-MM-dd") & "'"
选择Recordno,uhnumber,uhbuilding,uclocation from hydrantmaintain WHERE CONVERT(DATE,unndate)='&今天.Day& '
你可以试试这个。
我希望这个会帮助你。
"select Recordno, uhnumber,uhbuilding,uhlocation from hydrantmaintain WHERE CONVERT(DATE,unndate)= '" & Today.Day & "'"
You can try this .
I Hope this will help you.
这篇关于使用select在date = todays date中填充数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文