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


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

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

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


加好友 发短信
等级:童狐 帖子:275 积分:3241 威望:0 精华:0 注册:2017/10/4 1:48:00
请教一下 row 无法储存记录到资料库  发帖心情 Post By:2020/6/1 10:41:00 [显示全部帖子]

Dim i As Integer

Dim r As Row =Tables("pc_master").AddNew()
    r("primary_key")="2"
       r("pc_serial")="serial" & Date.Now
     r.Save

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

   messagebox.Show("saved ")
DataTables("pc_master").load

 资料库里然后什么都没有 ,请教一下




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


加好友 发短信
等级:童狐 帖子:275 积分:3241 威望:0 精华:0 注册:2017/10/4 1:48:00
  发帖心情 Post By:2020/6/1 13:22:00 [显示全部帖子]

没有啊 ,我自己用 sql select 查 , 资料库也是什么都没有

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


加好友 发短信
等级:童狐 帖子:275 积分:3241 威望:0 精华:0 注册:2017/10/4 1:48:00
  发帖心情 Post By:2020/6/1 14:24:00 [显示全部帖子]


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

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


加好友 发短信
等级:童狐 帖子:275 积分:3241 威望:0 精华:0 注册:2017/10/4 1:48:00
  发帖心情 Post By:2020/6/1 14:55:00 [显示全部帖子]

主键不是_Identify 是什么? 如果不是 _Identify 是不是就不能用 Tables("pc_master").AddNew() 了 ?

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


加好友 发短信
等级:童狐 帖子:275 积分:3241 威望:0 精华:0 注册:2017/10/4 1:48:00
  发帖心情 Post By:2020/6/1 16:39:00 [显示全部帖子]

感谢,感谢 ,我弄了几个晚上原来是这个原因啊 ,谢谢,另外 _identify 是自动生成的吗 ? 不用自己做自动编号吗?无论外表内表 ?



 回到顶部
帅哥哟,离线,有人找我吗?
kennypalm
  6楼 | 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 有分别吗 ? 有没有详细的网页介绍一下 ?

 回到顶部
帅哥哟,离线,有人找我吗?
kennypalm
  7楼 | 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
  8楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


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

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

 回到顶部
帅哥哟,离线,有人找我吗?
kennypalm
  9楼 | 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

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

 回到顶部
帅哥哟,离线,有人找我吗?
kennypalm
  10楼 | 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编辑过]

 回到顶部
总数 14 1 2 下一页