将表单1和表单2中的数据保存在mysql数据库中,并将2个数据保存在数据库中,不保存为double

时间:2017-06-04 09:08:55

标签: vb.net

表1

Public Sub InsertList()
    Dim cmd1 As New MySqlCommand
    Try
        ConnDB()
        For x = 0 To ListView1.Items.Count - 1

            sqL = "INSERT INTO invoice_items(Inv_in_id,Inv_Tag,Inv_items,Inv_Weight,Inv_dis100,Inv_disLKR,Inv_Price,Inv_qty,Inv_R,Inv_addedUser,Inv_date,Inv_time) VALUES ('" & txtInvoiceNo.Text & "','" & ListView1.Items(x).SubItems(0).Text & "','" & ListView1.Items(x).SubItems(6).Text & "','" & ListView1.Items(x).SubItems(2).Text.Trim & "','" & ListView1.Items(x).SubItems(3).Text.Trim & "','" & ListView1.Items(x).SubItems(4).Text & "','" & ListView1.Items(x).SubItems(5).Text & "','" & ListView1.Items(x).SubItems(7).Text & "','" & ListView1.Items(x).SubItems(8).Text & "','" & frmmdimain.txtactive.Text & "','" & frmmdimain.txtdate.Text & "','" & frmmdimain.txttime.Text & "' )"

            cmd = New MySqlCommand(sqL, conn)
            cmd.ExecuteNonQuery()
        Next
    Catch ex As Exception
        MsgBox(ex.Message)
    Finally
        cmd.Dispose()
        conn.Close()
    End Try

    Try
        ConnDB()
        sql1 = "INSERT INTO transtraction(t_in_id,t_sale,t_cus_name,t_I_date,t_return,t_og,t_advance,t_subtotal,t_total,t_paid,t_Paytype,t_Balance,t_CC,t_Ex,t_cheque,t_bank,t_CNo,t_due,t_CnL,t_date,t_time,t_user) VALUES ('" & txtInvoiceNo.Text & "','" & txtsaleman.Tag & "','" & txtcusid.Text & "','" & lbldate.Text & "','" & txtreturn.Text & "','" & txtog.Text & "','" & txtAdInvoice.Text & "','" & txtsubtotal.Text & "','" & txttotal.Text & "','" & form2.txtamount.Text & "','" & form2.cmbpayment.Text & "','" & form2.lblbalance.Text & "','" & form2.txtcardNo.Text & "','" & form2.txtCEd.Text & "','" & form2.txtcheque.Text & "','" & form2.txtbank.Text & "','" & form2.lblcredit.Text & "','" & form2.lbldue.Text & "','" & lblbillCancel.Text & "','" & frmmdimain.txtdate.Text & "','" & frmmdimain.txttime.Text & "','" & frmmdimain.txtactive.Text & "' )"
        cmd1 = New MySqlCommand(sql1, conn)
        cmd1.ExecuteNonQuery()
    Catch ex As Exception
        MsgBox(ex.Message)
    Finally
        cmd1.Dispose()
        conn.Close()

    End Try
End Sub
Public Sub clear2ndtab()

    txttag.Text = ""
    lblpname.Text = ""
    lblweight.Text = "0.00"
    txtdiscount.Text = "0.00"
    lbldiscountlkr.Text = "0"
    txtsales.Text = "0.00"
    txtlast.Text = "0.00"
    lblitemId.Text = "0.00"
    lblg.Text = ""
    txtpriceafterdis.Text = "0.00"

End Sub

表格2

form 2 load

lbltotal.Text = frmsale.txttotal.Text

Private Sub txtamount_TextChanged(sender As Object, e As EventArgs) Handles txtamount.TextChanged

    lblbalance.Text = Format(Val(txtamount.Text) - Val(lbltotal.Text), "###0.00")
    lbldue.Text = Format(Val(lbltotal.Text) - Val(txtamount.Text), "###0.00")

End Sub

enter image description here

0 个答案:

没有答案