Question : Receiving error when submitting data to SQL Server through asp.net vb

I have a web form built in vb in the asp.net platform.  The form collects data from the user then inserts the data to an SQL server through a stored procedure.  The connection string is stored in the web config.  I cannot figure out why I continue to receive an error "The ConnectionString property has not been initialized."  I have never received this error. I am attaching the vb code behind the page.  Thanks for the help.
Code Snippet:
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:
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Net.Mail
------------------------------------------------
Partial Class Signup
    Inherits System.Web.UI.Page

    Private Function Record_Input() As Boolean

        Dim MyConn As New System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.AppSettings("center_1004_webConnectionString"))        
        Dim MyCmd As New System.Data.SqlClient.SqlCommand("cp_RecordNewUser", MyConn)
        MyCmd.CommandType = CommandType.StoredProcedure

        Dim objParam1, objParam2, objParam3, objParam4, objParam5, objParam6, _
        objParam7, objParam8, objParam9, objParam10, objParam11, objParam12, objParam13 As SqlParameter

        objParam1 = MyCmd.Parameters.Add("@Reg_Date", SqlDbType.DateTime)
        objParam2 = MyCmd.Parameters.Add("@Reg_IP", SqlDbType.VarChar)
        objParam3 = MyCmd.Parameters.Add("@First_Name", SqlDbType.VarChar)
        objParam4 = MyCmd.Parameters.Add("@Last_Name", SqlDbType.VarChar)
        objParam5 = MyCmd.Parameters.Add("@Address", SqlDbType.VarChar)
        objParam6 = MyCmd.Parameters.Add("@City", SqlDbType.VarChar)
        objParam7 = MyCmd.Parameters.Add("@State", SqlDbType.Int)
        objParam8 = MyCmd.Parameters.Add("@Zip", SqlDbType.VarChar)
        objParam9 = MyCmd.Parameters.Add("@Phone", SqlDbType.VarChar)
        objParam10 = MyCmd.Parameters.Add("@Gender", SqlDbType.Int)
        objParam11 = MyCmd.Parameters.Add("@Age_Group", SqlDbType.Int)
        objParam12 = MyCmd.Parameters.Add("@Email", SqlDbType.VarChar)
        objParam13 = MyCmd.Parameters.Add("@Password", SqlDbType.VarChar)

        objParam1.Direction = ParameterDirection.Input
        objParam2.Direction = ParameterDirection.Input
        objParam3.Direction = ParameterDirection.Input
        objParam4.Direction = ParameterDirection.Input
        objParam5.Direction = ParameterDirection.Input
        objParam6.Direction = ParameterDirection.Input
        objParam7.Direction = ParameterDirection.Input
        objParam8.Direction = ParameterDirection.Input
        objParam9.Direction = ParameterDirection.Input
        objParam10.Direction = ParameterDirection.Input
        objParam11.Direction = ParameterDirection.Input
        objParam12.Direction = ParameterDirection.Input
        objParam13.Direction = ParameterDirection.Input

        objParam1.Value = Now()                                                         'Registration Date
        objParam2.Value = GetIPAddress()                                                'Registration IP
        objParam3.Value = StrConv(Trim(tbx_FirstName.Text), VbStrConv.ProperCase)       'First Name
        objParam4.Value = StrConv(Trim(tbx_LastName.Text), VbStrConv.ProperCase)        'Last Name
        objParam5.Value = StrConv(Trim(tbx_Address.Text), VbStrConv.ProperCase)         'Address
        objParam6.Value = StrConv(Trim(tbx_City.Text), VbStrConv.ProperCase)            'City
        objParam7.Value = dd_State.SelectedValue                                        'State
        objParam8.Value = Trim(tbx_City.Text)                                           'Zip
        objParam9.Value = Trim(tbx_Phone.Text)                                          'Phone
        objParam10.Value = Trim(tbx_Phone.Text)                                         'Phone
        objParam11.Value = dd_AgeGroup.SelectedValue                                    'Age Group
        objParam12.Value = Trim(tbx_Email.Text)                                         'Email
        objParam12.Value = Trim(tbx_Password.Text)                                      'Password

        Try
            If MyConn.State = ConnectionState.Closed Then
                MyConn.Open()
            End If

            Dim ar As IAsyncResult = MyCmd.BeginExecuteNonQuery()
            While Not ar.IsCompleted
            End While
            Dim effected As Integer = MyCmd.EndExecuteNonQuery(ar)

            MyCmd.Connection.Close()

        Catch ex As Exception
            lblMessage.Text = "Error Submitting New User Data!"
        End Try

        If lblMessage.Text = "" Then
            Return True
        End If

    End Function

End Class

Answer : Receiving error when submitting data to SQL Server through asp.net vb

No choice really, you have to use both.  

<cfquery name="getTypes" .....>
SELECT  RecordType, COUNT(*) AS NumOfRecords
FROM     YourTable
GROUP BY RecordType
</cfquery>

Then just use the getTypes query in your cfchart
Random Solutions  
 
programming4us programming4us