Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27193

Still stuck with added a record :(

$
0
0
Hi.

i'm still stuck with a simple code :(

I'm doing a college project..a basic payroll system.VERY basic (as many of you prob know if you have seen my other posts)

After messing around with it i have someone managed to mess up my adding record part.

I have one table in a access database..I have used data binding to add the data (easy way i know)

here is my 'add record' code.

HTML Code:

Public Class JSDADDRECORD


    Private Sub JSDADDRECORD_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
    Private Sub txtAddRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAddRecord.Click
        JSDEMPLOYEEDETAILS.TblContactsTableAdapter.Insert(Me.txtFirstName.Text, Me.txtSurname.Text, Me.txtAddress.Text, Me.txtPostCode.Text, Me.txtContactNumber.Text, Me.txtStaffPosition.Text, Me.txtHours.Text, Me.txtPay.Text, Me.chkchecked.Checked.ToString)
        JSDEMPLOYEEDETAILS.TblContactsTableAdapter.Fill(JSDEMPLOYEEDETAILS.PayrollDataSet.tblContacts)
        MsgBox("Record Added")
        txtFirstName.Text = ""
        txtSurname.Text = ""
        txtAddress.Text = ""
        txtPostCode.Text = ""
        txtContactNumber.Text = ""
        txtHours.Text = ""
        txtPay.Text = ""
        chkchecked.Checked = False

    End Sub

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click

    End Sub
End Class


When run its coming up with a InvalidCastException was unhandled.

Conversion from string "" to type 'integer' is no vaild.


It comes up with that if i put data in it too.

Any help be great.

thanks.

Again you guys really help!!!

Viewing all articles
Browse latest Browse all 27193

Trending Articles



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