Can anyone give me a quick little break down of what I would need to do to
insert information into a database onClick of and Submit button? I am new
to all of this and have done it with datagrids, but want to do it with just
textboxes filled in and on click of the Submit button that it would take
those boxes and insert a record into the database. This is for C#. below
is a little of what I have on the submit button but I don't think it is
correct.
private void btnSubmit_Click (object sender, System.EventArg s e)
{
this.oleDbInser tCommand1.Comma ndText = @"INSERT INTO
CONFERENCE.REQU EST(CUID, REQ_NUM, REQ_TYPE, CREATE_DT, START_DT, END_DT,
START_TM, END_TM, REQ_TTL, ATTENDEE_QTY, SETUP_DT, SETUP_TM, REQ_DESC,
CATERING_IND, WALK_THRU_IND, STORAGE_IND, BREAKOUT_RM_IND , MATERIALS_IND,
SPECIAL_REQ_TXT , REQ_STATUS, UPDATE_DT, UPDATED_BY_CUID ,
CARD_EXPIRATION _VALUE, CHARGE_CD, BILL_METHOD_CD) VALUES (?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
this.oleDbInser tCommand1.Conne ction = this.oleDbConne ction1;
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("CUID",
System.Data.Ole Db.OleDbType.Va rChar, 8, "CUID"));
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("REQ_NUM",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, false, ((System.Byte)( 10)),
((System.Byte)( 0)), "REQ_NUM", System.Data.Dat aRowVersion.Cur rent, null)); 3 1393
Hi Brian,
Assuming the sql command is correct, you'll have to add a parameter for each
? and assign a value (.Value property) to each.
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com www.rthand.com
"Brian Conway" <Br**********@q west.com> wrote in message
news:u0******** ******@TK2MSFTN GP09.phx.gbl... Can anyone give me a quick little break down of what I would need to do to insert information into a database onClick of and Submit button? I am new to all of this and have done it with datagrids, but want to do it with
just textboxes filled in and on click of the Submit button that it would take those boxes and insert a record into the database. This is for C#. below is a little of what I have on the submit button but I don't think it is correct.
private void btnSubmit_Click (object sender, System.EventArg s e)
{
this.oleDbInser tCommand1.Comma ndText = @"INSERT INTO CONFERENCE.REQU EST(CUID, REQ_NUM, REQ_TYPE, CREATE_DT, START_DT, END_DT, START_TM, END_TM, REQ_TTL, ATTENDEE_QTY, SETUP_DT, SETUP_TM, REQ_DESC, CATERING_IND, WALK_THRU_IND, STORAGE_IND, BREAKOUT_RM_IND , MATERIALS_IND, SPECIAL_REQ_TXT , REQ_STATUS, UPDATE_DT, UPDATED_BY_CUID , CARD_EXPIRATION _VALUE, CHARGE_CD, BILL_METHOD_CD) VALUES (?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
this.oleDbInser tCommand1.Conne ction = this.oleDbConne ction1;
this.oleDbInser tCommand1.Param eters.Add(new System.Data.Ole Db.OleDbParamet er("CUID", System.Data.Ole Db.OleDbType.Va rChar, 8, "CUID"));
this.oleDbInser tCommand1.Param eters.Add(new System.Data.Ole Db.OleDbParamet er("REQ_NUM", System.Data.Ole Db.OleDbType.De cimal, 0, System.Data.Par ameterDirection .Input, false, ((System.Byte)( 10)), ((System.Byte)( 0)), "REQ_NUM", System.Data.Dat aRowVersion.Cur rent, null));
Can you give me an example of how to do this. Are the insert commands in
the correct spot? Should I be putting these in the Submit button click
area?
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:e7******** ******@TK2MSFTN GP09.phx.gbl... Hi Brian,
Assuming the sql command is correct, you'll have to add a parameter for
each ? and assign a value (.Value property) to each.
-- Miha Markic [MVP C#] - RightHand .NET consulting & development miha at rthand com www.rthand.com
"Brian Conway" <Br**********@q west.com> wrote in message news:u0******** ******@TK2MSFTN GP09.phx.gbl... Can anyone give me a quick little break down of what I would need to do
to insert information into a database onClick of and Submit button? I am
new to all of this and have done it with datagrids, but want to do it with just textboxes filled in and on click of the Submit button that it would take those boxes and insert a record into the database. This is for C#.
below is a little of what I have on the submit button but I don't think it is correct.
private void btnSubmit_Click (object sender, System.EventArg s e)
{
this.oleDbInser tCommand1.Comma ndText = @"INSERT INTO CONFERENCE.REQU EST(CUID, REQ_NUM, REQ_TYPE, CREATE_DT, START_DT, END_DT, START_TM, END_TM, REQ_TTL, ATTENDEE_QTY, SETUP_DT, SETUP_TM, REQ_DESC, CATERING_IND, WALK_THRU_IND, STORAGE_IND, BREAKOUT_RM_IND ,
MATERIALS_IND, SPECIAL_REQ_TXT , REQ_STATUS, UPDATE_DT, UPDATED_BY_CUID , CARD_EXPIRATION _VALUE, CHARGE_CD, BILL_METHOD_CD) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
this.oleDbInser tCommand1.Conne ction = this.oleDbConne ction1;
this.oleDbInser tCommand1.Param eters.Add(new System.Data.Ole Db.OleDbParamet er("CUID", System.Data.Ole Db.OleDbType.Va rChar, 8, "CUID"));
this.oleDbInser tCommand1.Param eters.Add(new System.Data.Ole Db.OleDbParamet er("REQ_NUM", System.Data.Ole Db.OleDbType.De cimal, 0, System.Data.Par ameterDirection .Input, false, ((System.Byte)( 10)), ((System.Byte)( 0)), "REQ_NUM", System.Data.Dat aRowVersion.Cur rent,
null));
Hi,
"Brian Conway" <Br**********@q west.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. .. Can you give me an example of how to do this. Are the insert commands in the correct spot?
I guess so.
Should I be putting these in the Submit button click area?
You might define the command and parameters at class level somewhere.
Within the submit method you just set parameter values.
See the
Inserting Data Into a SQL Database
..net help topic - it will give you an idea of what to do.
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com www.rthand.com
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:e7******** ******@TK2MSFTN GP09.phx.gbl... Hi Brian,
Assuming the sql command is correct, you'll have to add a parameter for each ? and assign a value (.Value property) to each.
-- Miha Markic [MVP C#] - RightHand .NET consulting & development miha at rthand com www.rthand.com
"Brian Conway" <Br**********@q west.com> wrote in message news:u0******** ******@TK2MSFTN GP09.phx.gbl... Can anyone give me a quick little break down of what I would need to
do to insert information into a database onClick of and Submit button? I am new to all of this and have done it with datagrids, but want to do it with just textboxes filled in and on click of the Submit button that it would
take those boxes and insert a record into the database. This is for C#. below is a little of what I have on the submit button but I don't think it
is correct.
private void btnSubmit_Click (object sender, System.EventArg s e)
{
this.oleDbInser tCommand1.Comma ndText = @"INSERT INTO CONFERENCE.REQU EST(CUID, REQ_NUM, REQ_TYPE, CREATE_DT, START_DT,
END_DT, START_TM, END_TM, REQ_TTL, ATTENDEE_QTY, SETUP_DT, SETUP_TM, REQ_DESC, CATERING_IND, WALK_THRU_IND, STORAGE_IND, BREAKOUT_RM_IND , MATERIALS_IND, SPECIAL_REQ_TXT , REQ_STATUS, UPDATE_DT, UPDATED_BY_CUID , CARD_EXPIRATION _VALUE, CHARGE_CD, BILL_METHOD_CD) VALUES (?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
this.oleDbInser tCommand1.Conne ction = this.oleDbConne ction1;
this.oleDbInser tCommand1.Param eters.Add(new System.Data.Ole Db.OleDbParamet er("CUID", System.Data.Ole Db.OleDbType.Va rChar, 8, "CUID"));
this.oleDbInser tCommand1.Param eters.Add(new System.Data.Ole Db.OleDbParamet er("REQ_NUM", System.Data.Ole Db.OleDbType.De cimal, 0, System.Data.Par ameterDirection .Input, false, ((System.Byte)( 10)), ((System.Byte)( 0)), "REQ_NUM", System.Data.Dat aRowVersion.Cur rent, null));
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bill Kellaway |
last post by:
Hi there - this should be fairly simple for someone. Basically I
can't figure out how to pass the parameters from ASP to a Stored
Procedure on SQL.
Here's my code:
I just need to help in learning how to pass these varibables from ASP
to the SP.
|
by: 73blazer |
last post by:
Hello,
I'm looking for a way to make some of my insert templates more readable
by placing comments in between the values. I cannot seem to find a way
to do this with DB2, is there a way? I'm probably missing something basic.
I have
insert into ken.snyder id1,id2,id3
values (
|
by: Mike Hnatt |
last post by:
My goal is to get data from an XML file into a couple of tables in an Access
database. The XML file is a little complex so I need control over what I do
(I can't just read it into a dataset).
The way I have it now is ennumerating through my XML file and for each
record, running an INSERT INTO SQL statement to put the values in the...
|
by: Manuel Canas |
last post by:
Hello there,
This is my SQL Insert Statement to insert a single into a table on a
database;
INSERT tb_test VALUES(' & _
txtTest1.Text & "' " & _
txtTest2.Text & "' " & _
txtPrice.Text & "')"
|
by: Kevin Lawrence |
last post by:
Hi all
I want to do "INSERT INTO Table (Blob) Values('blobdataasstring')".
...rather than using the parameter driven method, is it possible? And if so
what encoder do I use to convert the bytes to string format?
Thanks
Kev
| |
by: Ian Semmel |
last post by:
The generated INSERT statement in a typed dataset has an INSERT statement
followed by a SELECT statement which gets (I think) the value of the
autoincremented ID.
Question. How do I get hold of this value ?
|
by: Andrevv |
last post by:
Hi all! Im totaly new in programing, so i need some help if someone can help me...
Im programing in VS 2005, C# language and using MS SQL Server 2005 .
So, after i fill my table with 10 records, i would like to use First In First Out ordering process. The problem is, that after the DELETE statement, when i trigger the INSERT statement, the...
|
by: anu b |
last post by:
Hi
I need to use Clr trigger for insert command
My code is as below
I am using SQL server 2005 and VS 2008.... but after running this
code
i didnt get the result as i expexted it shows the result as no row
is
effected ...Please help me guys
using System;
|
by: gilesy |
last post by:
Hi, I have a ploblem with an insert statement using an access database, I have the same code with a sql database which works but it doesn't seem to work on access. Could someone please help.
For i = 0 To dg.Rows.Count - 1
Main.Command.CommandText = "INSERT INTO Diary (Date1, Time, Appointment) VALUES (?, ?, ?)"
Dim...
|
by: gilesy |
last post by:
Hi, I have a ploblem with an insert statement using an access database, I have the same code with a sql database which works but it doesn't seem to work on access. Could someone please help.
For i = 0 To dg.Rows.Count - 1
Main.Command.CommandText = "INSERT INTO Diary (Date1, Time, Appointment) VALUES (?, ?, ?)"
Dim param1 As...
|
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...
| |
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...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
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...
| |