NewB Insert Question

  • Thread starter Thread starter jsugamele
  • Start date Start date
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.
 
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
 
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

Back
Top