the connectionString property has not been initialized
i face a problem that show connectionString not yet been initialize..
in web.config i hav these code
Code:
<connectionStrings>
<add name="ConnectionString" connectionString="Provider=SQLOLEDB;Data Source=SERVERNAME;Persist Security Info=True;Password=PASSWORD;User ID=USER;Initial Catalog=Northwind"
providerName="System.Data.OleDb" />
</connectionStrings>
and in my .vb page i hav these
Code:
Protected Sub btnAddUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsertCategory.Click
Dim sqlConn As New SqlConnection
Dim strConnection As String
strConnection = System.Configuration.ConfigurationManager.AppSettings("connectionString")
sqlConn = New SqlConnection(strConnection)
sqlConn.Open()
Try
Dim command As New SqlCommand("spAddUser", sqlConn)
command.CommandType = CommandType.StoredProcedure
command.Parameters.AddWithValue("@intUserID", "6")
command.Parameters.AddWithValue("@ncharname", "Pauly")
command.Parameters.AddWithValue("@ncharUserName", "Paul")
command.Parameters.AddWithValue("@intDepartmentID", "1")
command.Parameters.AddWithValue("@intContactNo", "1235")
command.ExecuteNonQuery()
Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Critical)
Throw
Finally
sqlConn.Close()
End Try
End Sub
pls help... thanks..
Re: the connectionString property has not been initialized
Regardless of anything else, that's not a valid connection string for an SqlConnection anyway. As the config says, it's for OleDb, not SqlClient. See www.connectionstrings.com for valid formats.