473,396 Members | 1,866 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,396 software developers and data experts.

Insert Data

I'm new using visual basic, I'm programmer in visual foxpro and I want try
visual basic .net

I would like to know how i can insert data from a form using insert.

I already have 3 textbox in my form and a botton, only i need the code to
insert in my table which is Ms access.

I would like to use the insert command, please help me.
Rafael
Nov 21 '05 #1
4 1141
try http://www.dotnetspider.com/technolo...RUDSample.aspx

Shivprasad Koirala
C# , VB.NET , SQL SERVER , ASP.NET Interview Questions
http://www.geocities.com/dotnetinterviews/

Nov 21 '05 #2
Rafael,

You can use the Insert command, however mostly is used the dataset, a
datatable, a dataadapter and databinding with dotNet.

See this sample how the use of buttons and textboxes becomes than very
simple
http://www.windowsformsdatagridhelp....9-4deb7fa4a0b8

For the update you use the dataadapter.update
I see now that we have nothing for that on our website so that will be soon.

In fact it can go in general like this (for the first table in the dataset)
sample for the most part typed in this message so watch errors.
\\\
(imports system.data.oledb)

Dim Conn As New OleDbConnection("connectionstring")
Try
Dim da As New OleDbDataAdapter(sqlstring, Conn)
da.SelectCommand.CommandTimeout = 160
Dim cb As New OleDbCommandBuilder(da)
Bindingcontext(ds.Tables(0)).EndCurrentEdit
If ds.HasChanges Then
da.Update(ds.Tables(0))
End If
Catch ex As OleDbException
'procedures to Handlde the errors
Catch ex As Exception
'procedures to handle the errors
End Try
////
Nov 21 '05 #3
"Rafael Tejera" <te****@charter.net> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP12.phx.gbl...
I'm new using visual basic, I'm programmer in visual foxpro and I want try
visual basic .net

I would like to know how i can insert data from a form using insert.

I already have 3 textbox in my form and a botton, only i need the code to
insert in my table which is Ms access.

I would like to use the insert command, please help me.


http://msdn.microsoft.com/library/en...withadonet.asp
http://msdn.microsoft.com/library/en...chitecture.asp
http://msdn.microsoft.com/library/en...tingDataVB.asp

Armin

Nov 21 '05 #4
This is my function for executing UPDATE, INSERT and DELETE commands on
a database. You just supply the SQL statement and the connection
string and then execute the function.

Public Function ExecDB(ByVal ExecuteQuery As String, ByVal
ConnectionString As String) As Boolean
' This function takes in a execute statement and a database
connection
' string and will execute the statement on the database and
report true/false
' if it executed properly or not

Try
Dim oleConn As New OleDbConnection(ConnectionString)
Dim oleCmd As New OleDbCommand(ExecuteQuery, oleConn)
oleCmd.Connection.Open()
oleCmd.ExecuteNonQuery()
oleConn.Close()
oleCmd.Dispose()
Return True
Catch ex As Exception
MessageBox.Show("Database Error:" & Chr(10) & ex.Message)
Return False
End Try
End Function

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
6
by: Mark P | last post by:
Some time ago I posted here about inserting into a set with a hint: ...
6
by: pk | last post by:
Sorry for the piece-by-piece nature of this post, I moved it from a dormant group to this one and it was 3 separate posts in the other group. Anyway... I'm trying to bulk insert a text file of...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
4
by: authorking | last post by:
I use the following code to insert a data record in to a datatable of an access database.But every time I execute the command, there will rise an exception and the insert operation can't be...
2
by: Polyhedron_12 | last post by:
I am having problems calling functions in general in VB. I keep getting alot of errors. Can anybody help me out with this? I put the error message on the same line that it says it is at. I believe...
2
by: Geoffrey KRETZ | last post by:
Hello, I'm wondering if the following behaviour is the correct one for PostGreSQL (7.4 on UNIX). I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching the following request :...
2
by: wombat53 | last post by:
Hi Group Are there any DB2 UDB ESE DPF V8.2 users exploiting "buffered inserts" (BIND parm INSERT BUF) *and* "multi-row INSERTS" (many rows associated with the VALUES clause of the INSERT to...
6
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
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,...
0
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...
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
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
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,...

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.