Quantcast
Viewing all articles
Browse latest Browse all 27083

VS 2012 problem with btnadd to access 2013

hello

iam using visual basic 2012 i want to add into access 2013 DB

what the error in the code ??

Code:

Private Sub btnadd_Click(sender As Object, e As EventArgs) Handles btnadd.Click
        If cBoxCustNames.Text = "" Then
            MessageBox.Show("Please fill in the Customer name", "Pharmacy System")
            cBoxCustNames.Focus()
        ElseIf txtMobile.Text = "" Then
            MessageBox.Show("Please fill in the Mobile", "Pharmacy System")
            txtMobile.Focus()
        ElseIf txtPrice.Text = "" Then
            MessageBox.Show("Please fill in the Price", "Pharmacy System")
            txtPrice.Focus()
        ElseIf txtBalance.Text = "" Then
            MessageBox.Show("Please fill in the pharmacist Balance", "Pharmacy System")
            txtBalance.Focus()
        ElseIf txtForm.Text = "" Then
            MessageBox.Show("Please fill in the pharmacist Form", "Pharmacy System")
            txtForm.Focus()
        ElseIf txtdate.Text = "" Then
            MessageBox.Show("Please fill in the pharmacist Date", "Pharmacy System")
            txtdate.Focus()
        ElseIf txtorder.Text = "" Then
            MessageBox.Show("Please fill in the pharmacist Order", "Pharmacy System")
            txtorder.Focus()
        Else
            Try
                conn.Open()

                Dim cmd As New System.Data.OleDb.OleDbCommand("Insert Into Customers (CustName,CustMobile,OrderPrice,OrderBlanace,CustForm,DateOrder,CustomerOrder) values ('" & cBoxCustNames.Text & "','" & txtMobile.Text & "','" & txtPrice.Text & "','" & txtBalance.Text & "','" & txtForm.Text & "','" & txtdate.Text & "','" & txtorder.Text & "')
                Dim dr As System.Data.OleDb.OleDbDataReader
                conn.Close()

                MessageBox.Show("details have been added successfully.", "Pharmacy System", MessageBoxButtons.OK, MessageBoxIcon.Information)
                Me.Hide()
            Catch ex As Exception
                MessageBox.Show(ex.Message, "btnadd_Click")
            End Try
        End If
    End Sub
End Class

i need a help please

cBoxCustNames = ( ComboBox )

Viewing all articles
Browse latest Browse all 27083


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>