Foxtable(狐表)用户栏目专家坐堂 → 不知怎的第一项绑定总是丢了


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

主题:不知怎的第一项绑定总是丢了

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


加好友 发短信
等级:童狐 帖子:275 积分:3253 威望:0 精华:0 注册:2017/10/4 1:48:00
不知怎的第一项绑定总是丢了  发帖心情 Post By:2020/6/20 16:53:00 [只看该作者]


如图所示 ,已经绑定数据库,但按新增后 输入 1,2,3,4 项时,第一项总会自己丢掉,没法保存



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


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


[此贴子已经被作者于2020/6/20 16:54:16编辑过]

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


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

控件和表事件分别有什么代码?

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


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

这个是 form load 事件

Dim lbl_status As WinForm.Label = e.Form.Controls("lbl_status")
Dim cmd_Add_detail As WinForm.Button = e.Form.Controls("cmd_Add_detail")
Dim str_pc_serial As String
Dim I As Integer
Dim pc_transaction As Table = e.Form.Controls("pc_transaction").Table


cmd_Add_detail.Text=vars("msg_input") & vars("datagrid.detail")
P_Row_status=""
P_DataRow_status=""


DataTables("pc_master").load()


If Tables("pc_master").Count>0  Then
    

If Tables("pc_master").Position=0 Then
    
    i=Tables("pc_master").Position+1
Else
    i=Tables("pc_master").Position
    End  If
    
    Dim r As Row =Tables("pc_master").Current
    str_pc_serial=        r("pc_serial")
    '    messagebox .Show (" str_pc_serial " & str_pc_serial )
    DataTables("pc_transaction").loadfilter = "pc_serial='"&  str_pc_serial &"' "
    DataTables("pc_transaction").load()
    
    
    lbl_status.Text= vars("records")  & " : " &    i  & " / " &  Tables("pc_master").Count
End If

'DataTables("pc_transaction").loadtop = Nothing
'DataTables("pc_transaction").load()

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


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

这个是保存按键事件

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_item_barcode As  WinForm.TextBox = e.Form.Controls("txt_item_barcode")
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 pc_index As  String
Dim com_cat As WinForm.ComboBox = e.Form.Controls("com_cat")
Dim str(10) As String
Dim str_date As String
Dim str_pc_serial As String

P_selected_formname="PC_Master"

If len(txt_pc_cpu.text)=0 Then
    str(1)=vars("msg_not_input")
    str(2)=vars("msg_data")
    str(0)=str(1) & str(2)
    messagebox.Show (str(0))
    Exit Sub
End If

str_date=Format(Date.now,("yyyyMMddHHmmss"))


If len(txt_inv_number.Text)=0 Then
    txt_inv_number.Text= DataTables("pc_master") .Compute("Max(invoice_number)") + 1
     messagebox.Show (" txt_inv_number.Text " & txt_inv_number.Text )
End If

If len(str_pc_serial )=0 Then
    p_primary_key = DataTables("pc_master") .Compute("Max(primary_key)") + 1
    Functions.execute("Sub_GetSerial")
    str_pc_serial=P_primary_key &"_" & P_pc_serial
    'messagebox.Show (" str_pc_serial " & str_pc_serial )
End If
    
    
    P_Row_pc_master("primary_key")=p_primary_key
    P_Row_pc_master("pc_serial")=str_pc_serial
    P_Row_pc_master("invoice_number")=txt_inv_number.Text
    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
    
    
    If len(com_cat.Text)>0 Then
        p_Row_pc_master("cat_code")=com_cat.Text
    Else
        p_Row_pc_master("cat_code")="cat_code"
    End If
    
    
    p_Row_pc_master("item_no")="item_no"
    p_Row_pc_master("item_cdesc")=txt_item_desc.Text
    p_Row_pc_master("item_barcode")=txt_item_barcode.Text
    
    p_Row_pc_master("pc_cpu")=txt_pc_cpu.Text
    p_Row_pc_master("pc_wifi_ip")=txt_wifi_ip.Text
    p_Row_pc_master("pc_lan_ip")=txt_lan_ip.Text
    p_Row_pc_master("pc_hdd_info")=txt_hdd_info.Text
    p_Row_pc_master("pc_monitor")=txt_monitor.Text
    p_Row_pc_master("pc_motherboard")=txt_motherboard.Text
    
    p_Row_pc_master("customer_no")=P_Customer_No
    p_Row_pc_master("customer_tel")=txt_customer_tel.Text
    
    pc_index=P_computer_name & "_" & P_Sales_Code &"_" & P_Customer_Card_No &"_" &  txt_customer_cname.Text  &"_" & txt_inv_number.Text
    MessageBox.Show ("pc_index " & pc_index )
    p_Row_pc_master("pc_index")=pc_index
    p_Row_pc_master("shopcode")=p_company_shopcode
    p_Row_pc_master("updated_on")=Date.now
    
    If len(P_Sales_Code)>0 Then
        p_Row_pc_master("updated_by")=P_Sales_Code
    Else
        p_Row_pc_master("updated_by")="admin"
    End If
    
    P_Row_pc_master.Save
    'Tables("pc_master").current.save()
    
    'DataTables("pc_master").Save()
    
    messagebox.Show (vars("msg_saved_records") )
    
    'DataTables("pc_master").load()
    P_Row_status=""
    P_DataRow_status=""


 回到顶部