473,408 Members | 1,840 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.

updating a database through a visual basic form

1
Hi
i need to update a database which is connected to a form in visual basic.
the entries that made in text boxes present in the form must be updated to the connected database.
Can u help me with a sample code..

thanks,
Jul 26 '08 #1
3 1180
smartchap
236 100+
Using ADO and its update method u can update the data written in textboxes or a grid etc in a form. For updating u can place a command button on form which is clicked after all fields / controls on the form are filled as required.
Jul 26 '08 #2
oumaG
1
<QUOTE>
Ms Access
using ADO you can write the following code
Public dbase As New ADODB.Connection
Public rsconn As New ADODB.Recordset
Set dbase = New ADODB.Connection
dbase.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\databaseName.mdb"
Set rsconn = New ADODB.Recordset
Set rsconn = dbase.Execute("UPDATE tableName SET field1 = '" & txtfieldName.Text &"' WHERE keyField = '" & txtkeyField.Text & "'")

With rsconn
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.Source = "select * from ItableName "
.ActiveConnection = dbase
.Open

End With


Set rsconn = Nothing
Set dbase = Nothing
</QUOTE>
Jul 26 '08 #3
debasisdas
8,127 Expert 4TB
TRY USING THIS


Expand|Select|Wrap|Line Numbers
  1. con.begintrans                   'con is the ADODB connection object
  2. con.execute "your insert / update statement here"
  3. con.committrans
  4.  
  5.  
Jul 26 '08 #4

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
3
by: Robin Tucker | last post by:
Hi there, I have a database on my test machine that will need to be installed on users machines. I would like to create the database with the given schema on the users machine and also with...
1
by: nicole bissell | last post by:
Hello, I am working in a new form and still making changes to the visual basic code of the form. Not always, but very often when I try to save my changes in the visual basic window and press the...
9
by: A P | last post by:
Hi! I have created a sample datagrid that can update data on a database. Please help me solve the problem, I have attached both aspx and code behind (aspx.vb): ______________________ ...
0
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database...
13
by: Daniel Walzenbach | last post by:
Hi, Imagine the following situation: I have an asp.net application which allows uploading files to a SQL Server 2000 database (Files are stored as type "images"). As a next step I would like to...
1
by: Rado | last post by:
Hello. I have One problem. Whan I make database program in Visual Basic 6 which has some Forms. I make Dataenvironment. There I make connection to my database. In command I select table or write...
0
by: pmaers | last post by:
I need a source code in Visual Basic .Net regarding about updating data records using MS Access database (.MDB).
28
by: Randy Reimers | last post by:
(Hope I'm posting this correctly, otherwise - sorry!, don't know what else to do) I wrote a set of programs "many" years ago, running in a type of basic, called "Thoroughbred Basic", a type of...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
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.