C
clynnekent
Guest
Good day,newbie here I started to learn some basic program using VB 2010. So as a title said I encounter some hardship about some error especially this one.
Im using Textbox for Id number,firstname,lastname,description and DatatimePicker for the date.
Code:
' This one is to get the AID and their is no problem of this one
Private Sub absentcellone_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If cn.State = ConnectionState.Open Then
cn.Close()
End If
connectionmod1.conn()
cn.Open()
ds.Clear()
str = "select * from tblsample"
cmd = New OleDbCommand(str, cn)
da.SelectCommand = cmd
da.Fill(ds, "tblsample")
Dim LastNo As Integer
LastNo = ds.Tables("tblsample").Rows.Count + 1
If LastNo >= 0 Then
txtdum.Text = "AO" & LastNo
Else
txtdum.Text = "AO" & 0
End If
End Sub
__________________________________________________________
This second program has a error
ds.Clear()
cmd.Connection = cn
cmd.CommandText = "insert into tblsample(AID,e_id,e_fname,e_lname,description,AOne) values('" & txtdum.Text & "', '" & txtaidno.Text & " ','" & txtafname.Text & " ','" & txtalname.Text & " ','" & txtdescription.Text & " ','" & dtpadate.Text & "')"
cmd.ExecuteNonQuery()
MessageBox.Show("Absent Successfully Added!")
Any Help please thanks in advance..
Continue reading...
Im using Textbox for Id number,firstname,lastname,description and DatatimePicker for the date.
Code:
' This one is to get the AID and their is no problem of this one
Private Sub absentcellone_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If cn.State = ConnectionState.Open Then
cn.Close()
End If
connectionmod1.conn()
cn.Open()
ds.Clear()
str = "select * from tblsample"
cmd = New OleDbCommand(str, cn)
da.SelectCommand = cmd
da.Fill(ds, "tblsample")
Dim LastNo As Integer
LastNo = ds.Tables("tblsample").Rows.Count + 1
If LastNo >= 0 Then
txtdum.Text = "AO" & LastNo
Else
txtdum.Text = "AO" & 0
End If
End Sub
__________________________________________________________
This second program has a error
ds.Clear()
cmd.Connection = cn
cmd.CommandText = "insert into tblsample(AID,e_id,e_fname,e_lname,description,AOne) values('" & txtdum.Text & "', '" & txtaidno.Text & " ','" & txtafname.Text & " ','" & txtalname.Text & " ','" & txtdescription.Text & " ','" & dtpadate.Text & "')"
cmd.ExecuteNonQuery()
MessageBox.Show("Absent Successfully Added!")
Any Help please thanks in advance..
Continue reading...