时间可以这样用吗?paddtime=#" & Now() & "#在vb.net(asp.net+sqlserver)里paddtime=#" & Now() & "#
解决方案 »
- 关于asp.net (c#)叶面单据和报表套打的问题
- asp.net mvc JQGrid获取数据问题
- DetailsView某列设定只读后不能更新问题
- 奇怪:网站在开发vs运行没有问题在iis里面就有问题?
- 怎么让一个页面弹出时,再点击一个按钮时,而不会在弹出一个新的页面
- webconfig配置问题?突然报错,不知所措,大家帮我?????????????
- 大型网站如何存放图片文件
- 关于数据显示
- 请教关于window.open的问题。我在验证后用window.open打开了新窗口,怎么把现在的窗口关闭呢?谢谢!
- 关于用C#动态生成HTML的问题
- 为什么数字在td中显示时会让表格变形
- 问一个GridView的问题...
可以这样起时间System.DataTime.Nows.shorttostring()
sqlserver直接用getdate()再进行转换
是System.DateTime.Now.ToShortDateString()
paddtime是数据库中的字段让数据库中的字段paddtime=#" & Now() & "#
Dim txtid, txttypeid, txtpro_id, txtpname, txtpimageurl, txtpsprice, txtphprice, txtpaddtime, txtpintro, txtcc, txtyxq As TextBox
txtid = e.Item.Cells(3).Controls(0)
txttypeid = e.Item.Cells(4).Controls(0)
txtpro_id = e.Item.Cells(5).Controls(0)
txtpname = e.Item.Cells(6).Controls(0)
txtpimageurl = e.Item.Cells(7).Controls(0)
txtpsprice = e.Item.Cells(8).Controls(0)
txtphprice = e.Item.Cells(9).Controls(0)
txtpaddtime = e.Item.Cells(10).Controls(0)
txtpintro = e.Item.Cells(11).Controls(0)
txtcc = e.Item.Cells(12).Controls(0)
Dim strsql As String
strsql = "update product set typeid='" & txttypeid.Text & "',pro_id='" & txtpro_id.Text & "',pname='" & txtpname.Text & "',pimageurl='" & txtpimageurl.Text & "',psprice='" & txtpsprice.Text & "',phprice='" & txtphprice.Text & "',pintro='" & txtpintro.Text & "',cc='" & txtcc.Text & "',paddtime=#" & Now() & "# where id=" & DataGrid1.DataKeys(CInt(e.Item.ItemIndex))
Dim conn As New SqlConnection("server=(local);database=xf;uid=sa;pwd=997mb;")
Dim cmd As New SqlCommand(strsql, conn)
'Dim exp As Exception
'Try
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
'Catch exp
'Label3.Text = "发生错误,没有正常更新记录,请重新修改!"
'End Try
DataGrid1.EditItemIndex = -1
Call myDataBind()
End Sub