Newbee question, regarding database (SQL)

  • Thread starter Thread starter Visual Systems AB \(Martin Arvidsson\)
  • Start date Start date
V

Visual Systems AB \(Martin Arvidsson\)

Hi all!

Sorry if this is the wrong NG for this type of Q.

On my .aspx page i have a TextControl and a button.

When i press the button, i want to insert the changes to my SQL database
how do i achive this...

Retrieving data is done by the DataBind i thing but, inserting, and
updating?

BTW. Is there a good site for tutoring DataBase handeling in V.Studio .NET?
besides the www.asp.net site?

Best regards

Martin
 
There are thousand of tutorials for this kind of thing.
For example:
http://www.c-sharpcorner.com/Code/2002/Oct/UsingSQLP1.asp

or simply do a google search:
http://www.google.com/search?sourceid=mozclient&ie=utf-8&oe=utf-8&q=introduction+to+ADO.Net

Very basically, what you want to do is something like this in your button's
click event:

Dim conn as new SqlConnection("YOUR CONNECTION STRING")
dim cmd as new SqlCommand("INSERT INTO TableName Value = '" &
textControl.Text & "'", conn)
try
conn.open()
cmd.executeNonQuery()
finally
conn.close()
conn.dispose()
cmd.dispose()
end try

Karl
 
Back
Top