以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 代码转换求助 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=191686) |
-- 作者:夜点蚊香 -- 发布时间:2024/5/1 7:00:00 -- 代码转换求助 foxtable 代码 Dim dt As DataTable = Functions.Execute("生成cmd数据表","打卡数据","") dt.StopRedraw() \'停止绘制 Dim nms1() As String nms1 = New String() {"姓名","身份证号码","时间"} Dim r As DataRow = dt.AddNew() Dim mm As Integer = 1 For m1 As Integer = 0 To nms1.Length - 1 Dim ss1 As String = nms1(m1) If dt.DataCols(ss1).IsDate Then \'如果是日期类型的列 r(ss1)= ary(n + 1,mm) Else r(ss1) = ary(n + 1,mm) End If mm = mm + 1 Next r.save() 修改成 sql 代码,怎么改, 时间判断的地方怎么加,求助 Dim cmdadd As new SQLCommand cmdadd.C cmdadd.CommandText = "Insert Into 打卡数据 (姓名,身份证号码,时间) Values(?,?,?)" For m1 As Integer = 0 To nms1.Length - 1 Dim ss1 As String = nms1(m1) If dt.DataCols(ss1).IsDate Then \'如果是日期类型的列 cmdadd.Parameters.Add("@" & ss1,ary(n + 1,mm)) Else cmdadd.Parameters.Add("@" & ss1,ary(n + 1,mm)) End If mm = mm + 1 Next cmdadd.ExecuteNonQuery |
-- 作者:有点蓝 -- 发布时间:2024/5/1 11:24:00 -- 不需要判断,直接用 |