connection with vb.net

adding details to the ms access database

Page 1 of 1

1 Replies - 314 Views - Last Post: 23 March 2009 - 03:50 AM Rate Topic: -----

#1 sanare  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-March 09

connection with vb.net

Post icon  Posted 23 March 2009 - 03:26 AM

If cmbCashierID.Text = "" Or txtCashierName.Text = "" Or txtPhoneNo.Text = "" Or txtCashierAddress.Text = "" Or _
txtManagerID.Text = "" Or txtCashierCity.Text = "" Then

MsgBox("All the fields need to be filled")
Exit Sub
cmbCashierID.Focus()
End If

'code to commit changes


Try
dbConnect()
cmd.CommandText = "INSERT into Cashier values(" & cmbCashierID.Text & ", '" & txtPhoneNo.Text & ", '" & txtCashierName.Text & "', '" & txtCashierCity.Text & "','" & txtCashierAddress.Text & "', '" & txtManagerID.Text & "')"
cmd.Connection = con
cmd.ExecuteNonQuery()
cmd.CommandText = ""


'to update the database table object
da.Update(dt)
dt.AcceptChanges()

MsgBox("Cashier details successfuly entered")

btnCommit.Enabled = False
btnAdd.Enabled = True
btnUpdate.Enabled = True
btnDelete.Enabled = True


Catch ex As Exception
MessageBox.Show("Error: " & ex.Message)
End Try


cmbCashierID.Text = CashierID
txtCashierName.Text = CashierName
txtCashierAddress.Text = CashierAddress
txtCashierCity.Text = CashierCity
txtManagerID.Text = ManagerID
txtPhoneNo.Text = PhoneNo

End Sub

Is This A Good Question/Topic? 0
  • +

Replies To: connection with vb.net

#2 jens  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 67
  • View blog
  • Posts: 430
  • Joined: 09-May 08

Re: connection with vb.net

Posted 23 March 2009 - 03:50 AM

Ok? Did you have a question?
:code:

Please be specific about what problems you have. If possible point out the line giving you troubles. Otherwise explain what you are attempting and what is going wrong.

Regards
/Jens
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1