vb error

Results 1 to 2 of 2

Thread: vb error

  1. #1
    Join Date
    Dec 1969

    Default vb error

    I&#039;m completely stumped with this error. I&#039;ve check over the code five times and can&#039;t get... <BR><BR>/////error///// <BR>The ConnectionString property has not been initialized. <BR>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <BR><BR>Exception Details: System.InvalidOperationException: The ConnectionString property has not been initialized. <BR><BR>Source Error: <BR><BR><BR>Line 21: <BR>Line 22: Dim PostMsg As New ASPFree.InsertMsg <BR>Line 23: PostMsg.PostRecord(Name, EmailAddress, Href, Message) <BR>Line 24: End If <BR>Line 25: BindGrid() <BR><BR>////code//// <BR>Public Sub PostRecord(Name as String, EmailAddress as String, Href as String, Message as String) <BR><BR>&#039; Create Instance of Connection and Command Object <BR>Dim myConnection As OleDbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=c:websites
    la_db.mdb") <BR><BR>Dim InsertString As String = "Insert into guestbookdotnet (Name, EmailAddress, Href, Message) VALUES (@Name, @Emailaddress, @Href, @Message )" <BR><BR>Dim MyCommand As OleDbCommand = New OleDbCommand(InsertString, myConnection) <BR><BR>MyCommand.Parameters.Add(New OleDbParameter("@Name")) <BR>MyCommand.Parameters("@Name").Value = Name <BR><BR>MyCommand.Parameters.Add(New OleDbParameter("@EmailAddress")) <BR>MyCommand.Parameters("@EmailAddress").Value = Emailaddress <BR><BR>MyCommand.Parameters.Add(New OleDbParameter("@Href")) <BR>MyCommand.Parameters("@Href").Value = Href <BR><BR>MyCommand.Parameters.Add(New OleDbParameter("@Message")) <BR>MyCommand.Parameters("@Message").Value = Message <BR><BR>Try <BR>&#039; Open the connection and execute the Command <BR>myConnection.Open() <BR>MyCommand.ExecuteNonQuery() <BR>Catch e As Exception <BR>&#039;An error occurred, pass the exception up <BR>throw e <BR>Finally <BR><BR>&#039; Close the Connection <BR>If myConnection.State = ConnectionState.Open then <BR>myConnection.Close() <BR>End If <BR>End Try <BR><BR><BR>End Sub <BR><BR>End Class

  2. #2
    Join Date
    Dec 1969

    Default RE: vb error

    Just out of curiosity, have you stepped through that code the see exactly where the error is being thrown? Are you 100% positive that it is thrown from within the PostRecord method and not your BindGrid method?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts