borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (VB compile error with Access 2003 Form across network)Next Topic (SQL) New Topic New Poll Post Reply
AndreaVB Forum : Database : Database with MS access in vb .net
Poster Message
ben
Level: Protégé

Registered: 12-05-2006
Posts: 6

icon Database with MS access in vb .net

I want to use microsoft access for my database. I was told to use sql but my sch computer doesn't have SQL server.

So how do i link the database table to my program?? kindly list the coding and steps for me to do this. The first step is creating a table at microsoft access right?? I'm using VB .NET


I dun understand how to code except hearing things about "Dim db as database" and I am not sure how to link my database to program...thanks...urgent

19-05-2006 at 11:09 AM
View Profile Send Email to User Show All Posts | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 891
icon Re: Database with MS access in vb .net

Hi,
Have you tried google?
Here's one I found:
http://www.daniweb.com/techtalkforums/thread18984.html
Hope this helps,
Kieron


____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

20-05-2006 at 10:07 PM
View Profile Send Email to User Show All Posts | Quote Reply
ba1959nh
Level: Scholar

Registered: 10-05-2006
Posts: 39
icon Re: Database with MS access in vb .net

Here is another posted example....

http://www.devcity.net/Articles/34/msaccess_sp2.aspx

NOTE: The emphasis is on Stored Procedures, but it looks like it might cover Access db related code as well.

Good Luck




[Edited by ba1959nh on 21-05-2006 at 03:34 PM GMT]

21-05-2006 at 03:33 PM
View Profile Send Email to User Show All Posts | Quote Reply
lbuntha
Level: Scholar

Registered: 05-05-2006
Posts: 39
icon Re: Database with MS access in vb .net

Hi
I think it is good option you choose vb.net to develop your database system.
In vb.net, you must use ado.net to connect to your database.
-------------------------------------------------------------------
Private cnn As OleDbConnection
Public Sub ConnectToDatabase(ByVal DatabasePath As String)
        cnn = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.jet.oledb.4.0; data source=" & DatabasePath)
        cnn.Open()
    End Sub

You write it in form load or class moudule

____________________________
ly buntha

24-05-2006 at 01:50 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
ben
Level: Protégé

Registered: 12-05-2006
Posts: 6
icon Re: Database with MS access in vb .net

Imports System
Imports System.Data
Imports System.Data.Oledb

Public Class Form1
    Inherits System.Windows.Forms.Form
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      
    End Sub

    Private Sub Add_Btn_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Add_Btn.Click
        Try

            Me.OleDbDataAdapter1.InsertCommand.CommandText = "INSERT INTO Test (Name, Block, Floor, Hp)" + "VALUES('" + Me.Name_textbox.Text + "','" + Me.Block_textbox.Text + "' ,'" + Me.Floor_textbox.Text + "' ,'" + Me.Hp_textbox.Text + "')"
            Me.OleDbConnection1.Open()
            Me.OleDbDataAdapter1.InsertCommand.Connection = OleDbConnection1
            Me.OleDbDataAdapter1.InsertCommand.ExecuteNonQuery()
            Me.OleDbConnection1.Close()
            MessageBox.Show("Record Added")
            Me.Name_textbox.Text = ""
            Me.Block_textbox.Text = ""
            Me.Floor_textbox.Text = ""
            Me.Hp_textbox.Text = ""

        Catch exp As System.Data.OleDb.OleDbException
            Me.OleDbConnection1.Close()
            MessageBox.Show(exp.ToString)
        End Try
    End Sub
End Class

Can anyone help me with this??
I entered the necessary data into the text boxes and clicked the add_btn button....it says record added but i check my database table but the record is not added inside?? Thanks

26-05-2006 at 04:20 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : Database with MS access in vb .net
Previous Topic (VB compile error with Access 2003 Form across network)Next Topic (SQL) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder