关于用程序插入数据,用SQL查询的问题

fsxw1974 2009-04-14 02:08:10
rkstr = "insert into RKLS values ('" & UCase(Text1.Text) & "','" & Trim(Text2.Text) & " '," & Text3.Text & " , " & Text4.Text & " ,'" & Text5.Text & "','" & datestr & "'," & Text3.Text & "*" & Text4.Text & ")"
End If

ypconn.BeginTrans '执行插入数据命令
Dim rkcmd As New ADODB.Command
Set rkcmd.ActiveConnection = ypconn
rkcmd.CommandText = rkstr
rkcmd.Execute
ypconn.CommitTrans '提交命令
其中text2.text是名称
在SQL中查询时:

SQL> select * from rkls;

编号 名称 单价 数量 规格 日期
-------------------- -------------------- --------- --------- -------------------- ----------
合计
---------
44 电话 50 100 步步高 2009.04.14
5000


SQL> select * from rkls where 名称='电话';

未选定行
...全文
72 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
fsxw1974 2009-04-15
  • 打赏
  • 举报
回复
不明白
饮水需思源 2009-04-14
  • 打赏
  • 举报
回复
rkstr = "insert into RKLS values ('" & UCase(Text1.Text) & "','" & Trim(Text2.Text) & " '," & Text3.Text & " , " & Text4.Text & " ,'" & Text5.Text & "','" & datestr & "'," & Text3.Text & "*" & Text4.Text & ")" 
End If

ypconn.BeginTrans '执行插入数据命令
ypconn.execute rkstr
ypconn.CommitTrans '提交命令


1,217

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧