473,408 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

how to insert data into acess from vb2005

'this is my code plz guys help how to save data from vb 2005 and other this that i am able to view the data from acess but i am not able save to acess i dont whether my code for save is correct of not ( iam using vb2005 as front end and MS acess as by back end)

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Database1_beDataSet.Table1' table. You can move, or remove it, as needed.
Me.Table1TableAdapter.Fill(Me.Database1_beDataSet. Table1)
End Sub

Private Sub cmdnew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdnew.Click
Me.Table1BindingSource.AddNew()
End Sub

Private Sub cmdfirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdfirst.Click
Me.Table1BindingSource.MoveFirst()
If (Val(TextBox1.Text) = 1) Then
MsgBox("This first record")
End If
End Sub

Private Sub cmdprevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdprevious.Click
Me.Table1BindingSource.MovePrevious()
If (Val(TextBox1.Text) = 1) Then
MsgBox("This first record")
End If
End Sub

Private Sub cmdlast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdlast.Click
Me.Table1BindingSource.MoveLast()
End Sub

Private Sub cmdnext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdnext.Click
Me.Table1BindingSource.MoveNext()
End Sub

Private Sub cmdsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsave.Click
Dim consql3 As OleDb.OleDbConnection = _
New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLED B.4.0;Data Source=|DataDirectory|\Database1_be.mdb;")
'Caminho da base de dados
consql3.Open() 'abre a conexao com o banco
'query de busca
Dim sql3 As String = "INSERT INTO Table1(name, class, dept, physis, chemistry, maths) VALUES('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "')"
Dim comam3 As OleDb.OleDbCommand
comam3 = New OleDb.OleDbCommand(sql3, consql3)
Dim adapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(comam3)

comam3 = New OleDb.OleDbCommand(sql3, consql3)
consql3.Close()
End Sub

Private Sub cmdclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
End Sub
End Class
Sep 18 '08 #1
1 1881
debasisdas
8,127 Expert 4TB
are you getting any error with your code ?
Sep 19 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Fabrice | last post by:
Hello everybody, I'm working with Access 2002. I have to import Data from a Foxpro table that contains 25000 records in an Access table. I have a couple of restrictions placed on me for the...
1
by: Chris Strug | last post by:
Hi, Probably a very silly question but I've been scratching my head for days now so... I'd also like to point out that my knowledge of VB.net is somewhat limited... I recently downloaded...
0
by: minhadd | last post by:
Hello Would Anyone help me ?? I want insert into Microsoft Acess visitor's IP by ASP. But It is not working ...
3
by: Anna | last post by:
Hi: I have a table in Access in which some of the fields are linked with other tables in the same databse. I create a datagrid in VB.NET but the fields which are lookup it also shows as an...
2
by: technocraze | last post by:
Hi guys, I have encountered this error when updating the values to the MS Acess table. Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and...
1
by: technocraze | last post by:
Hi guys, I am having trouble resolving this error. Below mentioned is my code and implmentation. MS Acess is my front end and sql server is my backend. What i want to achieve is to be...
1
by: qwer | last post by:
hi im actually doing on a SMS application using Visual Basic.Net whereby the objective is to allow the user to send a SMS to the visual basic programme and i should decode out the hp no, car plate,...
2
by: riyap | last post by:
hi can anyone help me to simplify my logic in writing code, i have ms acess database table.i want to get the data from there(using select command with where clause) and insert into a stored...
0
parshupooja
by: parshupooja | last post by:
Hey All, I am trying to create utility to check data inconsistency in ASP.net 2.0 C# means I want to compare two databases in two different sources i.e MS Access and SQL Server. I want to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.