NewB Insert Question

J

jsugamele

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.
 
K

Karl Seguin [MVP]

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
 
J

jsugamele

How do i go about creating the connection and the command object. I am
sorry I am new to this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top