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
|