Advertisement
Advertisement
| 03.31.2008 at 05:13PM PDT, ID: 23284381 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: |
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import Namespace="system.data.sqlclient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim username As String = String.Empty
Dim password As String = String.Empty
Dim email As String = String.Empty
Dim fname AS String = String.Empty
Dim lname AS String = String.Empty
Dim age As String = String.Empty
Dim contact As String = String.Empty
Dim address As String = String.Empty
Dim suburb AS String = String.Empty
Dim state As String = String.Empty
Dim postcode AS String = String.Empty
Dim country As String = String.Empty
Dim phone As String = String.Empty
Dim pregnant AS String = String.Empty
Dim boys As String = String.Empty
Dim girls As String = String.Empty
Dim childage1 As String = String.Empty
Dim childage2 As String = String.Empty
Dim childage3 As String = String.Empty
Dim childage4 As String = String.Empty
Dim childage5 As String = String.Empty
Dim feedingmethod AS String = String.Empty
Dim purchase As String = String.Empty
Dim hearabout As String = String.Empty
If Not IsNothing(Request.Form("username")) Then
username = Request.Form("username").Trim
End If
If Not IsNothing(Request.Form("password")) Then
password = Request.Form("password").Trim
End If
If Not IsNothing(Request.Form("email")) Then
email = Request.Form("email").Trim
End If
If Not IsNothing(Request.Form("age")) Then
age = Request.Form("age").Trim
End If
If Not IsNothing(Request.Form("lname")) Then
lname = Request.Form("lname").Trim
End If
If Not IsNothing(Request.Form("fname")) Then
fname = Request.Form("fname").Trim
End If
If Not IsNothing(Request.Form("contact")) Then
contact = Request.Form("contact").Trim
End If
If Not IsNothing(Request.Form("address")) Then
address = Request.Form("address").Trim
End If
If Not IsNothing(Request.Form("suburb")) Then
suburb = Request.Form("suburb").Trim
End If
If Not IsNothing(Request.Form("state")) Then
state = Request.Form("state").Trim
End If
If Not IsNothing(Request.Form("postcode")) Then
postcode = Request.Form("postcode").Trim
End If
If Not IsNothing(Request.Form("country")) Then
country = Request.Form("country").Trim
End If
If Not IsNothing(Request.Form("phone")) Then
phone = Request.Form("phone").Trim
End If
If Not IsNothing(Request.Form("pregnant")) Then
pregnant = Request.Form("pregnant").Trim
End If
If Not IsNothing(Request.Form("boys")) Then
boys = Request.Form("boys").Trim
End If
If Not IsNothing(Request.Form("girls")) Then
girls = Request.Form("girls").Trim
End If
If Not IsNothing(Request.Form("age1")) Then
childage1 = Request.Form("age1").Trim
End If
If Not IsNothing(Request.Form("age2")) Then
childage2 = Request.Form("age2").Trim
End If
If Not IsNothing(Request.Form("age3")) Then
childage3 = Request.Form("age3").Trim
End If
If Not IsNothing(Request.Form("age4")) Then
childage4 = Request.Form("age4").Trim
End If
If Not IsNothing(Request.Form("age5")) Then
childage5 = Request.Form("age5").Trim
End If
If Not IsNothing(Request.Form("feeding")) Then
feedingmethod = Request.Form("feeding").Trim
End If
If Not IsNothing(Request.Form("purchase")) Then
purchase = Request.Form("purchase").Trim
End If
If Not IsNothing(Request.Form("hearabout")) Then
hearabout = Request.Form("hearabout").Trim
End If
Dim sqlc As New SqlCommand
sqlc.Connection = New SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_conn_abbott_2"))
sqlc.CommandText = "INSERT INTO abbot3.members_tbl(login_id, password, email, agegroup, firstname, lastname, contactmethod, address, suburb, state, postcode, country, phone, pregnant, boys, girls, childage1, childage2, childage3, childage4, childage5, feedingmethod, purchase, hearabout ) VALUES ('" & username & "', '" & password & "', '" & email & "', '" & age & "', '" & fname & "','" & lname & "', '" & contact & "', '" & address & "', '" & suburb & "', '" & state & "', '" & postcode & "', '" & country & "', '" & phone & "', '" & pregnant & "', '" & boys & "', '" & girls & "', '" & childage1 & "', '" & childage2 & "', '" & childage3 & "', '" & childage4 & "', '" & childage5 & "', '" & feedingmethod & "', '" & purchase & "', '" & hearabout & "')"
sqlc.CommandType = Data.CommandType.Text
Dim myWriter As System.IO.TextWriter
myWriter = Response.Output
Try
sqlc.Connection.Open()
sqlc.ExecuteNonQuery()
Catch ex As System.Data.SqlClient.SqlException
If ex.ToString().IndexOf("Cannot insert duplicate key") > 0 Then
myWriter.WriteLine("&error=DUPLICATE_INDEX&")
Else
myWriter.WriteLine("&error=GENERAL_ERROR&errorMessage="&ex.ToString()&"&")
End If
Catch ex As Exception
'HERE YOU SHOULD PRINT THE ERROR OUTPUT
myWriter.WriteLine("&error=GENERAL_ERROR&errorMessage="&ex.ToString()&"&")
Finally
sqlc.Connection.Close()
sqlc.Connection.Dispose()
sqlc.Dispose()
End Try
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
</form>
</body>
</html>
|