| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2449 人关注过本帖
标题:DateTimePicker1的值插入到数据库的问题
取消只看楼主 加入收藏
helifu
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-12-9
收藏
 问题点数:0 回复次数:3 
DateTimePicker1的值插入到数据库的问题
我的form中有个DateTimePicker1
我要把DateTimePicker1的输入保存到SQl数据库中去要怎么弄
SQL语句我是知道的,我想知道怎么得到那上面的输入值

搜索更多相关主题的帖子: 数据库 
2006-12-11 16:42
helifu
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-12-9
收藏
得分:0 

我写好了SQL语句,在执行时报“从字符串转为Datatime时发生语法错误”

2006-12-11 19:42
helifu
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-12-9
收藏
得分:0 

不是那个问题了,出新问题了
'年12月11日附近有语法错误。'
我的SQL语句: strsql = "update Employees set ELName='" & TextYGXS.Text & "',EFName='" & TextYGXM.Text & "',Address='" & TextDZ.Text & "',City='" & TextSZCS.Text & "',State='" & TextSZSF.Text & "',Zip='" & TextYB.Text & "',Phone='" & TextDH.Text & "',Dob=" & DateTimePicker2.Text & ",Doj=" & DateTimePicker1.Text & ",Designation='" & ComboZW.Text & "',DeptID='" & ComboSSBM.Text & "',Password='" & TEXTMM.Text & "' where EmpID='" & ComboYGID.Text & "'"
麻烦了

2006-12-11 20:22
helifu
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-12-9
收藏
得分:0 

strsql = "update Employees set ELName='" & TextYGXS.Text & "',EFName='" & TextYGXM.Text & "',Address='" & TextDZ.Text & "',City='" & TextSZCS.Text & "',State='" & TextSZSF.Text & "',Zip='" & TextYB.Text & "',Phone='" & TextDH.Text & "',Dob=" & DateTimePicker2.Text & ",Doj=" & DateTimePicker1.Text & ",Designation='" & ComboZW.Text & "',DeptID='" & ComboSSBM.Text & "',Password='" & TEXTMM.Text & "' where EmpID='" & ComboYGID.Text & "'"

Public Function updatedatabase(ByVal SQLcmd As String)
Try
Dim conn As SqlConnection
Dim cmd As SqlCommand
conn = New SqlConnection(Connstr)
conn.Open()
cmd = New SqlCommand(SQLcmd, conn)
cmd.ExecuteNonQuery()在这个地方就跳到下面去了
conn.Close()

Catch ex As Exception
MsgBox(ex.Message)

2006-12-11 21:09
快速回复:DateTimePicker1的值插入到数据库的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024722 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved