Add Data to Ms Access Database

I dont know how to add data

Page 1 of 1

2 Replies - 10252 Views - Last Post: 19 September 2008 - 03:01 PM Rate Topic: -----

#1 cybecks  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 19-September 08

Add Data to Ms Access Database

Posted 19 September 2008 - 07:38 AM

Hello I very new ath VB.Net I've created a Login database using MS Access. I need to add new users to the database. I've created the input form and have was able to connect to ythe data base. here is my code.


 Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click

		On Error Resume Next
		If UsernameTextBox.Text = "" Or PasswordTextBox.Text = "" Or SystemTextBox.Text = "" Then
			MsgBox("Please Insert A User Name And/Or Password.", vbExclamation, "Error!")
			Exit Sub
			
What do I Do using VB.net in adding the data to the Plog.mdb Is their some way to do a SQL Statement to Insert the record.

 

In VB6 I would do the following:

Module1
Global mrstDB As New ADODB.recordset

then do  like this:

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click

		On Error Resume Next
		If UsernameTextBox.Text = "" Or PasswordTextBox.Text = "" Or SystemTextBox.Text = "" Then
			MsgBox("Please Insert A User Name And/Or Password.", vbExclamation, "Error!")
			Exit Sub


			 mrstDB.AddNew()
			 mrstDB("User") = UsernameTextBox.Text 
			 mrstDB("Password") = PasswordTextBox.Te
			 mrstDB("System") =SystemTextBox.Text 
			 mrstDB.Update()
			 Unload(Me)

		End If
	   End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: Add Data to Ms Access Database

#2 magicmonkey  Icon User is offline

  • D.I.C Regular

Reputation: 106
  • View blog
  • Posts: 484
  • Joined: 12-September 08

Re: Add Data to Ms Access Database

Posted 19 September 2008 - 01:01 PM

ADO has changed a lot with .NET. You want to look at the ADO.NET Connection, DataAdapter, Command, DataReader, Dataset, DataTable objects. You can find them in the System.Data namespace. I not 100% sure but I also don't think VS express allows access to ADO.NET, so if you are using the free version you may need to upgrade.
Was This Post Helpful? 0
  • +
  • -

#3 Damage  Icon User is offline

  • Lord of Schwing
  • member icon

Reputation: 27
  • Posts: 1,088
  • Joined: 05-June 08

Re: Add Data to Ms Access Database

Posted 19 September 2008 - 03:01 PM

you can check out the tutorial section here to get you started as well
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1