How to Add data to database and send it also no an email?

  • Thread starter Miguel Dias Moura
  • Start date
M

Miguel Dias Moura

Hello,

i have an ASP.net / VB page with a Script (submitValues) and a Form.

1. The form has 10 input text and a "Submit" button.
2. The script declares 10 variables. The value of each variable is taken
from each of the 10 input texts.
3. When the button "Submit" is click the variable values are sent to an
email address using AspNetEmail.

As an example, the button code is this one:
<asp:Button ID="submit" runat="server" OnClick="submitValues"
Text="Submit"/>

What i want is to add a new record in a database and insert this values in
it. I allready created the dataSet to the database.

So, when the "Submit" button is clicked, the values are inserted in a new
record in the database and are also sent to my email.

Can you help me out?

Thanks,
Miguel
 
A

Alex Papadimoulis

Miguel,

You will need to add the values to your dataset, and then use a DataAdapter
to update.

Or, you could always just use a simple command and some paramaters ...

cmd = new SqlCommand("INSERT INTO ... VALUES @name")
cmd.paramaters.add("@name",Name)
cmd.connection = new sqlconnection( ConnectionString )
cmd.connection.open
cmd.executeNonQuery
cmd.connection.close

-- Alex Papadimoulis
 

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

Top