Incorrect syntax near '#'. VB.net with SQL database

前端 未结 2 575
天涯浪人
天涯浪人 2021-01-15 02:05

i\'m trying to get the Max field where date = today using this code:

    Dim todaydate = Format(Today.Date, \"dd/MM/yyyy\")
    Dim sql1 As String = \"Select         


        
2条回答
  •  旧巷少年郎
    2021-01-15 02:35

    You need to use a single quote instead of hash here, it would be better if you could use string.format as well (instead of manually concatenating)

    Dim sql1 As String = String.Format("select max(snum) from tblbill where idate='{0}'",todaydate)
    

提交回复
热议问题