Hi there,
VB 2003 1.1 Access Database, oledb, Windows Application
I've been trying this for 3 days straight now and CANNOT get this to
work, im about to go insane because it is soo simple. All I want to do
is insert a new row !
I have 1 table 'People'
In that table I have "Name" and "LastName" Name as primary Key."
my adapter is called OleDbDataAdapter1
my connection is called OleDbConnection1
and I have a dataset called DataSet11
my connection is
"Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data Source=""C:\Documents and
Settings\Pig\Desktop\New Folder\TEST" & _
".mdb"";Jet OLEDB:Engine
Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:Syste" & _
"m database=;Jet OLEDB:SFP=False;persist security
info=False;Extended Properties=" & _
";Mode=Share Deny None;Jet OLEDB:Encrypt Database=False;Jet
OLEDB:Create System D" & _
"atabase=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet
OLEDB:Compact Wit" & _
"hout Replica Repair=False;User ID=Admin;Jet OLEDB:Global Bulk
Transactions=1""
if anyone wants that.
On my form I have 2 text boxes
"txtname" and "txtlastname"
I also have a button "Button1"
All I want is for someone to put something in those two text boxes,,
press the button and for it to add a new Person with those 2 strings.
So they press the button and it adds a new row to the table, so like
adding a new person.
Can someone just tell me/show me how to do this, I'm having soo much
trouble, since I have asked about 50 people and tried about 50 differnt
ways and nothing works
PLEASE HELP ME.
thanx in advance 8 2540
Bonzol,
You were writing this in the thread where I asked why you not was using the
code from GhostAIk had given you.
This was your answer. yeah, I had a problem with it, and am waiting a reply in that other thread
What help do you want if you not tries what somebody gives you as
suggestion?
It was nice code for an insert in the way your question is asked.
Cor
"Bonzol" <Bo****@hotmail.com> schreef in bericht
news:11**********************@h76g2000cwa.googlegr oups.com... Hi there,
VB 2003 1.1 Access Database, oledb, Windows Application
I've been trying this for 3 days straight now and CANNOT get this to work, im about to go insane because it is soo simple. All I want to do is insert a new row !
I have 1 table 'People'
In that table I have "Name" and "LastName" Name as primary Key."
my adapter is called OleDbDataAdapter1 my connection is called OleDbConnection1 and I have a dataset called DataSet11
my connection is
"Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _ "ocking Mode=1;Data Source=""C:\Documents and Settings\Pig\Desktop\New Folder\TEST" & _ ".mdb"";Jet OLEDB:Engine Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:Syste" & _ "m database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=" & _ ";Mode=Share Deny None;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System D" & _ "atabase=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Wit" & _ "hout Replica Repair=False;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1""
if anyone wants that.
On my form I have 2 text boxes
"txtname" and "txtlastname" I also have a button "Button1"
All I want is for someone to put something in those two text boxes,, press the button and for it to add a new Person with those 2 strings.
So they press the button and it adds a new row to the table, so like adding a new person.
Can someone just tell me/show me how to do this, I'm having soo much trouble, since I have asked about 50 people and tried about 50 differnt ways and nothing works
PLEASE HELP ME.
thanx in advance
As I said up the top, I have tried 50 peoples code.
I couldnt get his code to work.
cor,, with regards to his code,
Dim tConnection As SqlConnection = New
SqlConnection(yourConnectionStringHere)
Dim tCommand As SqlCommand = New SqlCommand
how do I reformat that for an oledb database?
I have tried
' Dim Conn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\Documents and Settings\Pig\Desktop\New Folder\TEST.mdb;User
Id=admin;Password=;"
' Dim tConnection As New OleDb.OleDbConnection(Conn)
' Dim tCommand As New OleDb.OleDbCommand
but then that stops half the other code from working, since it was
reffering to SQL and now is not.
ok, finally got it for anyone else who wants to know also.
Some guy on another forum helped. Cheers anyway
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim Conn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\Documents and Settings\Pig\Desktop\New Folder\TEST.mdb;User
Id=admin;Password=;"
Dim tConnection As New OleDb.OleDbConnection(Conn)
Dim SQL As String = "INSERT INTO People ([Name], [LastName])
VALUES(@Name, @LastName)" 'The @ Are Parameters
Dim tCommand As New OleDb.OleDbCommand(SQL, tConnection)
With tCommand
'Add Parameter Values
.Parameters.Add("@Name", OleDb.OleDbType.VarChar)
.Parameters(0).Value = txtname.Text
.Parameters.Add("@LastName", OleDb.OleDbType.VarChar)
.Parameters(1).Value = txtlastname.Text
'Open Connection
.Connection.Open()
'Execute
.ExecuteNonQuery()
'Close Connection
.Connection.Close()
End With 'Done with Command
End Sub
Bonzol,
Not another forum this is the code you got from GhostInAk in this forum.
He was only not using your field names. He left something for you to do
yourself.
Why it is his code, because I see seldom using people tCommand as mnemonic
for a command, mostly it is cmd.
Cor
"Bonzol" <Bo****@hotmail.com> schreef in bericht
news:11**********************@g10g2000cwb.googlegr oups.com... ok, finally got it for anyone else who wants to know also. Some guy on another forum helped. Cheers anyway
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Conn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Pig\Desktop\New Folder\TEST.mdb;User Id=admin;Password=;" Dim tConnection As New OleDb.OleDbConnection(Conn) Dim SQL As String = "INSERT INTO People ([Name], [LastName]) VALUES(@Name, @LastName)" 'The @ Are Parameters Dim tCommand As New OleDb.OleDbCommand(SQL, tConnection)
With tCommand
'Add Parameter Values
.Parameters.Add("@Name", OleDb.OleDbType.VarChar) .Parameters(0).Value = txtname.Text .Parameters.Add("@LastName", OleDb.OleDbType.VarChar) .Parameters(1).Value = txtlastname.Text
'Open Connection .Connection.Open()
'Execute .ExecuteNonQuery()
'Close Connection .Connection.Close()
End With 'Done with Command
End Sub
The code he gave me was for SQL, I seeked help on another forum and
someone helped me. Don't worry I am very greatful for GhostinAk for
helping me. But Someone else showed me how to do this
..
Cor Ligthert [MVP] wrote: Bonzol,
Not another forum this is the code you got from GhostInAk in this forum.
He was only not using your field names. He left something for you to do yourself.
Why it is his code, because I see seldom using people tCommand as mnemonic for a command, mostly it is cmd.
Cor
"Bonzol" <Bo****@hotmail.com> schreef in bericht news:11**********************@g10g2000cwb.googlegr oups.com... ok, finally got it for anyone else who wants to know also. Some guy on another forum helped. Cheers anyway
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Conn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Pig\Desktop\New Folder\TEST.mdb;User Id=admin;Password=;" Dim tConnection As New OleDb.OleDbConnection(Conn) Dim SQL As String = "INSERT INTO People ([Name], [LastName]) VALUES(@Name, @LastName)" 'The @ Are Parameters Dim tCommand As New OleDb.OleDbCommand(SQL, tConnection)
With tCommand
'Add Parameter Values
.Parameters.Add("@Name", OleDb.OleDbType.VarChar) .Parameters(0).Value = txtname.Text .Parameters.Add("@LastName", OleDb.OleDbType.VarChar) .Parameters(1).Value = txtlastname.Text
'Open Connection .Connection.Open()
'Execute .ExecuteNonQuery()
'Close Connection .Connection.Close()
End With 'Done with Command
End Sub
it probbably happend that way, cause I refernced something from his
code to someone else. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sue |
last post by:
On code-behind page:
(attributes set programatically for each of these elements)
linkbutton added to tablecell
textbox added to tablecell
tablecells added to tablerow
tablerow added to table...
|
by: Jamie Fryatt |
last post by:
Hi everyone, here's what id like to do.
I have a table with 2 fields, name and value
I need to be able to add multiple records quickly, for example I need to add
name value
abc 1...
|
by: Paul |
last post by:
Hi
I have a table that currently has 466 columns and about 700,000
records. Adding a new DEFAULT column to this table takes a long time.
It it a lot faster to recreate the table with the new...
|
by: Chris Cobb |
last post by:
I have a table that currently contains 718000 rows. I wish to add a
column to the table. Adding this column anywhere other than the end of
the table requires exporting data, a drop and recreate,...
|
by: Raj |
last post by:
Hi,
I am trying to add some more information to the table which already
has a lot a data (like 2-3000 records). The new information may be
adding 2-3 new columns worth. Now my questions are:...
| |
by: Jim Heavey |
last post by:
Trying to figure out the technique which should be used
to add rows to a datagrid. I am thinking that I would
want an "Add" button on the footer, but I am not quite
sure how to do that. Is that...
|
by: Robin Thomas |
last post by:
I am fairly new to ASP.NET so I think I am missing something fundamental.
Anyway, quite often I am pulling data from a database, but then I need to
use that data to produce more data. A simple...
|
by: Sileesh |
last post by:
Hi
I have html table and a Button in an Aspx page. I am adding one row with
some textboxes to Html table each time i click on the Button thru Javascript.
Now problem is when when i try to...
|
by: Luis Esteban Valencia |
last post by:
Hello
I wrote a program with code behind in C# to add row into table
dynamically and the program worked very well in .Net Framework 1.1. When I
run this program in .Net Framework 2.0 beta...
|
by: Rudy |
last post by:
Hi all,
I know this is easy, just can't seem to get it. I have a windows form, and
a text box, with a value already in it. I need to add that value to a table.
It's just one value, so the entire...
|
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,...
| |
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,...
|
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...
|
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...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |