473,698 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to insert data into acess from vb2005

1 New Member
'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(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
'TODO: This line of code loads data into the 'Database1_beDa taSet.Table1' table. You can move, or remove it, as needed.
Me.Table1TableA dapter.Fill(Me. Database1_beDat aSet.Table1)
End Sub

Private Sub cmdnew_Click(By Val sender As System.Object, ByVal e As System.EventArg s) Handles cmdnew.Click
Me.Table1Bindin gSource.AddNew( )
End Sub

Private Sub cmdfirst_Click( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdfirst.Click
Me.Table1Bindin gSource.MoveFir st()
If (Val(TextBox1.T ext) = 1) Then
MsgBox("This first record")
End If
End Sub

Private Sub cmdprevious_Cli ck(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdprevious.Cli ck
Me.Table1Bindin gSource.MovePre vious()
If (Val(TextBox1.T ext) = 1) Then
MsgBox("This first record")
End If
End Sub

Private Sub cmdlast_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdlast.Click
Me.Table1Bindin gSource.MoveLas t()
End Sub

Private Sub cmdnext_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdnext.Click
Me.Table1Bindin gSource.MoveNex t()
End Sub

Private Sub cmdsave_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdsave.Click
Dim consql3 As OleDb.OleDbConn ection = _
New OleDb.OleDbConn ection("Provide r=Microsoft.Jet .OLEDB.4.0;Data Source=|DataDir ectory|\Databas e1_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.OleDbComm and
comam3 = New OleDb.OleDbComm and(sql3, consql3)
Dim adapter As OleDb.OleDbData Adapter = New OleDb.OleDbData Adapter(comam3)

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

Private Sub cmdclear_Click( ByVal sender As System.Object, ByVal e As System.EventArg s) 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 1904
debasisdas
8,127 Recognized Expert Expert
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
6435
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 solution: 1. I am not allowed to use ODBC 2. I have to use ADO 3. I am not allowed to use Linked tables
1
1095
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 VB2005 Express (and SQL Server 2005 Express). I also have an existing SQL Server 2000 install on my network.
0
1247
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 ---------------------------------------------------------------------------------------------------------- NOT WORK
3
1171
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 enterable fields. Is it possible that i do formatting inside the grid of some of the fields. Thanks,
2
4811
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 sql server is my backend server. This error occured whenever i step through and when it reaches rs.update it jux hangs down there and thereafter it shwn the aforementioned error. I am using the RecordSet properties to add the values. Can I use...
1
4559
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 able to insert StudentId in the table matching the values chosen in the combo boxes and listboxes. This sound more like searching the table to insert StudentId matching the criterias. I have set the necessary configuration for ODBC connection (File...
1
1466
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, time in,time out and date.And finally import the data(hp number, car plate number....as stated earlier) into Miscrosoft Access.I have already successfully decoded the data and May I know how i can import the decoded information/data into Microsoft...
2
1748
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 procedure in oracle database. stored procedure package has 8 i/p fields and 1 output feilds. when i insert fields i need to get the o/p value from it and update it into ms acess DB table. My doubt is how to get data from Acess and enter into stored...
0
1204
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 create application where I should provide two data connection strings one for Acess and one for SQL server and then I want to compare for ex: if I am comparing master DB and somebody has added table "xyz" in MS Acess master DB, then I want to generate a...
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7738
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5861
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.