Foxtable(狐表)用户栏目专家坐堂 → 请教一下 row 无法储存记录到资料库


  共有3779人关注过本帖树形打印复制链接

主题:请教一下 row 无法储存记录到资料库

帅哥哟,离线,有人找我吗?
kennypalm
  11楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:275 积分:3241 威望:0 精华:0 注册:2017/10/4 1:48:00
  发帖心情 Post By:2020/6/1 16:52:00 [只看该作者]

请问 tables add new 与 datatables add new 有分别吗 ? 有没有详细的网页介绍一下 ?

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:105926 积分:538693 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/6/1 16:59:00 [只看该作者]

帮助搜“addnew”

 回到顶部
帅哥哟,离线,有人找我吗?
kennypalm
  13楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:275 积分:3241 威望:0 精华:0 注册:2017/10/4 1:48:00
  发帖心情 Post By:2020/6/2 14:12:00 [只看该作者]

请问一下 , 为什么已经新增 ,却终是修改 第二个 记录 ,完全没有记录时 又能新增保存 。

新增部分 :

Dim txt_primary_key As WinForm.TextBox = e.Form.Controls("txt_primary_key")
Dim txt_inv_number As WinForm.TextBox = e.Form.Controls("txt_inv_number")
Dim txt_customer_cname As WinForm.TextBox = e.Form.Controls("txt_customer_cname")
Dim txt_customer_fax As WinForm.TextBox = e.Form.Controls("txt_customer_fax")
Dim txt_customer_no As WinForm.TextBox = e.Form.Controls("txt_customer_no")
Dim txt_customer_tel As WinForm.TextBox = e.Form.Controls("txt_customer_tel")
Dim txt_hdd_info As WinForm.TextBox = e.Form.Controls("txt_hdd_info")
Dim txt_item_desc As WinForm.TextBox = e.Form.Controls("txt_item_desc")
Dim txt_lan_ip As WinForm.TextBox = e.Form.Controls("txt_lan_ip")
Dim txt_monitor As WinForm.TextBox = e.Form.Controls("txt_monitor")
Dim txt_motherboard As WinForm.TextBox = e.Form.Controls("txt_motherboard")
Dim txt_pc_cpu As WinForm.TextBox = e.Form.Controls("txt_pc_cpu")
Dim txt_pc_remark As WinForm.TextBox = e.Form.Controls("txt_pc_remark")
Dim txt_photo_path1 As WinForm.TextBox = e.Form.Controls("txt_photo_path1")
Dim txt_photo_path2 As WinForm.TextBox = e.Form.Controls("txt_photo_path2")
Dim txt_photo_path3 As WinForm.TextBox = e.Form.Controls("txt_photo_path3")
Dim txt_photo_path4 As WinForm.TextBox = e.Form.Controls("txt_photo_path4")
Dim txt_photo_path5 As WinForm.TextBox = e.Form.Controls("txt_photo_path5")
Dim txt_wifi_ip As WinForm.TextBox = e.Form.Controls("txt_wifi_ip")
Dim str_pc_serial As String
Dim lbl_status As WinForm.Label = e.Form.Controls("lbl_status")

p_primary_key = DataTables("pc_master") .Compute("Max(primary_key)") + 1

P_Row_pc_master=Tables("pc_master").AddNew()
P_Row_pc_master("primary_key")=P_primary_key
P_Row_pc_master("invoice_number")=P_primary_key
txt_inv_number.Text=P_primary_key
txt_primary_key.Text=P_primary_key

保存部分:
Dim txt_primary_key As WinForm.TextBox = e.Form.Controls("txt_primary_key")
Dim txt_inv_number As WinForm.TextBox = e.Form.Controls("txt_inv_number")
Dim txt_customer_cname As WinForm.TextBox = e.Form.Controls("txt_customer_cname")
Dim txt_customer_fax As WinForm.TextBox = e.Form.Controls("txt_customer_fax")
Dim txt_customer_no As WinForm.TextBox = e.Form.Controls("txt_customer_no")
Dim txt_customer_tel As WinForm.TextBox = e.Form.Controls("txt_customer_tel")
Dim txt_hdd_info As WinForm.TextBox = e.Form.Controls("txt_hdd_info")
Dim txt_item_desc As WinForm.TextBox = e.Form.Controls("txt_item_desc")
Dim txt_lan_ip As WinForm.TextBox = e.Form.Controls("txt_lan_ip")
Dim txt_monitor As WinForm.TextBox = e.Form.Controls("txt_monitor")
Dim txt_motherboard As WinForm.TextBox = e.Form.Controls("txt_motherboard")
Dim txt_pc_cpu As WinForm.TextBox = e.Form.Controls("txt_pc_cpu")
Dim txt_pc_remark As WinForm.TextBox = e.Form.Controls("txt_pc_remark")
Dim txt_photo_path1 As WinForm.TextBox = e.Form.Controls("txt_photo_path1")
Dim txt_photo_path2 As WinForm.TextBox = e.Form.Controls("txt_photo_path2")
Dim txt_photo_path3 As WinForm.TextBox = e.Form.Controls("txt_photo_path3")
Dim txt_photo_path4 As WinForm.TextBox = e.Form.Controls("txt_photo_path4")
Dim txt_photo_path5 As WinForm.TextBox = e.Form.Controls("txt_photo_path5")
Dim txt_wifi_ip As WinForm.TextBox = e.Form.Controls("txt_wifi_ip")
Dim str_pc_serial As String


'p_primary_key = DataTables("pc_master") .Compute("Max(primary_key)") + 1
P_selected_formname="PC_Master"


messagebox.Show(" p_primary_key " & p_primary_key)

Functions.execute("Sub_GetSerial")
messagebox.Show (p_serial)   
str_pc_serial=P_Serial

P_Row_pc_master("primary_key")=P_primary_key
P_Row_pc_master("pc_cpu")=txt_pc_cpu.text
P_Row_pc_master("customer_cname")=txt_customer_cname.text
P_Row_pc_master("customer_fax")=txt_customer_fax.Text
P_Row_pc_master("customer_tel")=txt_customer_tel.Text
P_Row_pc_master("pc_hdd_info")=txt_hdd_info.Text
p_Row_pc_master("pc_serial")=str_pc_serial
P_Row_pc_master.Save

图片点击可在新窗口打开查看此主题相关图片如下:sp20200602_140826.png
图片点击可在新窗口打开查看


 回到顶部
帅哥哟,离线,有人找我吗?
kennypalm
  14楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:275 积分:3241 威望:0 精华:0 注册:2017/10/4 1:48:00
  发帖心情 Post By:2020/6/2 14:13:00 [只看该作者]

sql 查询只是不断更新 第二个记录
图片点击可在新窗口打开查看此主题相关图片如下:sp20200602_140902.png
图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  15楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:105926 积分:538693 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/6/2 14:35:00 [只看该作者]

P_Row_pc_master是一个全局变量?只要这个变量没有重新赋值,肯定操作的都是同一行数据呀。

 回到顶部
帅哥哟,离线,有人找我吗?
kennypalm
  16楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:275 积分:3241 威望:0 精华:0 注册:2017/10/4 1:48:00
  发帖心情 Post By:2020/6/2 15:03:00 [只看该作者]

是全局变量 , 

P_Row_pc_master=Tables("pc_master").AddNew()
P_Row_pc_master("primary_key")=P_primary_key
P_Row_pc_master("invoice_number")=P_primary_key
txt_inv_number.Text=P_primary_key
txt_primary_key.Text=P_primary_key

这一段 不算是 赋值吗 ?如果不算 ,那要怎样赋值 ? 我想加一个新的记录然后赋值

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  17楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:105926 积分:538693 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/6/2 15:10:00 [只看该作者]

保存代码没有AddNew(),所以P_Row_pc_master一直都是上一次AddNew()的行,如果保存的时候也要新增一行,需要再一次调用AddNew()

 回到顶部
帅哥哟,离线,有人找我吗?
kennypalm
  18楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:275 积分:3241 威望:0 精华:0 注册:2017/10/4 1:48:00
  发帖心情 Post By:2020/6/2 15:32:00 [只看该作者]

因为 我新增时需要清空 控件的值 所以调用了 addnew 清空 ,然后 再save 按钮再保存  这样不行吗 ? 如果不行 可以有什么好方法
一次过 清空 所有需要清空 的控件值 ?然后保存时 再赋值给 p_row , 因为按照你的方法好像会 新增了 2 个 行
[此贴子已经被作者于2020/6/2 15:33:01编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  19楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:105926 积分:538693 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/6/2 16:13:00 [只看该作者]

没看懂到底要干嘛,如果不需要增加2行,那么一直更新之前的数据不就对了么?

如果控件绑定了列,没有必要再手工给单元格赋值了吧。录入完毕直接保存即可,搞那么复杂干嘛

 回到顶部
帅哥哟,离线,有人找我吗?
kennypalm
  20楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:275 积分:3241 威望:0 精华:0 注册:2017/10/4 1:48:00
  发帖心情 Post By:2020/6/2 16:58:00 [只看该作者]

按照你的方法 ,试了一下,table 的更新有 ,我看见了,但 sql后台数据查的时候 却发现没有保存,不太明白,要按左上角的保存键才会保存到后台
如果我想要 保存时直接保存在 table 看见而且后台也保存了 要怎样做 ?


 回到顶部
总数 24 上一页 1 2 3 下一页