By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,206 Members | 1,035 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,206 IT Pros & Developers. It's quick & easy.

NewB Insert Question

P: n/a
This is my first shot at .net. This is a website and I am trying to
create a comments form. Simply I want the user to hit the submit
button and have the data stored into a database and a copy emailed to
me. All this new data stuff has me stumped. I have watch tutorials
and read a few articles. It is an access database, there are these new
datasets and accessdatasource. I have even tried to create them both
but have no clue where to go from there. Not sure which is right or
wrong. Any help greatly appreciated. Thanks in advance.

Mar 6 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Simply create a connection and a commant object, set the command text to
your INSERT statememt, set the parameters and execute..

command.CommandText = "INSERT INTO WHATEVER (Col1, col2) VALUES ('@val1',
'@val2')

command.Parameters.Add("@val1", SqlDbType.VarChar, 128).Value =
yourVariable;
command.Parameters.Add("@val2", SqlDbType.VarChar, 128).Value =
yourVariable2;

command.ExecuteNonQuery();

Karl

--
http://www.openmymind.net/

<js*******@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
This is my first shot at .net. This is a website and I am trying to
create a comments form. Simply I want the user to hit the submit
button and have the data stored into a database and a copy emailed to
me. All this new data stuff has me stumped. I have watch tutorials
and read a few articles. It is an access database, there are these new
datasets and accessdatasource. I have even tried to create them both
but have no clue where to go from there. Not sure which is right or
wrong. Any help greatly appreciated. Thanks in advance.

Mar 7 '06 #2

P: n/a
How do i go about creating the connection and the command object. I am
sorry I am new to this.

Mar 7 '06 #3

P: n/a
There's a simple example at the bottom:
http://authors.aspalliance.com/aspxt...lassctor3.aspx

they do a select instead of an update..but same kinda stuff. There are
plenty of examples online...

don't forget to dispose your connection and command by calling Dispose() on
them after ur done..

Karl

--
http://www.openmymind.net/

<js*******@gmail.com> wrote in message
news:11*********************@i39g2000cwa.googlegro ups.com...
How do i go about creating the connection and the command object. I am
sorry I am new to this.

Mar 7 '06 #4

P: n/a
Joe
Thank You Karl

Mar 7 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.