i face a problem that show connectionString not yet been initialize..
in web.config i hav these code
and in my .vb page i hav theseCode:<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>
pls help... thanks..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


Reply With Quote
