Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 9th, 2004, 10:43 AM
Authorized User
 
Join Date: Apr 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to insert new redord into a Database?

Im a student a Cleveland St Uninveristy and Im working a ASP.NET Web Application that suppossed to insert a new record in a database.
I have to turn this project in next Thursday.

The application has 3 area code and 3 phone text boxes. And 1 email text box.

Im trying to insert into a database the input from these text boxes.
Im putting the data from the area text boxes and phone text boxes into an array. Then I want to loop through the arrays and insert the data into a database. Here is my code below:
variable e1 holds the email address.

Private Sub btnRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRegister.Click
        Dim myCNN As New ADODB.Connection
        Dim mySQL As String
        Dim counter As Integer
        Dim registerDate As DateTime = Today
        Dim expireDate As DateTime = Today.AddYears(5)


        myCNN.Open("DSN=MyDoNotCall")
        counter = 0
        For counter = 1 To 3
            mySQL = "Insert INTO Master(PatronEmail,AreaCode,PhoneNumber,Registrati onDate,ExpirationDate) VALUES (e1,area(counter),phone(counter),registerDate,expi reDate)"
        Next
        myCNN.Close()
        myCNN = Nothing
    End Sub

Can anyone let me know if this is the right way of doing this?
Any help would greatly appreciated.

Thanks Eric

 
Old May 9th, 2004, 12:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

See: http://p2p.wrox.com/topic.asp?TOPIC_ID=13365





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to insert a value into database? [email protected] VB.NET 13 September 21st, 2006 10:38 AM
How to insert a value into database? [email protected] VB.NET 1 September 12th, 2006 01:35 PM
Can't insert into database chrscote Classic ASP Databases 1 June 15th, 2005 04:07 AM
Insert a record into a Database ersp Classic ASP Basics 3 May 9th, 2004 08:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.