Results 1 to 5 of 5

Thread: The ConnectionString property has not been initialized.

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2007
    Posts
    47

    The ConnectionString property has not been initialized.

    hey i m using the code
    Code:
    Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
            Dim selstr, insstr As String
            Dim i As Integer
            Dim obj As New DataClass
            Dim sqlConn As SqlConnection
            Dim sqlComm, insComm As SqlCommand
            Dim dr As SqlDataReader
            'i = Max("IssueNumber", "Master_Table") + 1
            Try
                selstr = "Select max(IssueNumber) From Master_Table"
                sqlConn = obj.makeConnection()
                sqlComm = New SqlCommand(selstr, sqlConn)
                dr = sqlComm.ExecuteReader
                dr.Read()
                i = CInt(dr(0).ToString) + 1
                insstr = "Insert into Master_Table([IssueNumber],[Flag]) Values(" & i & " ,'Open')"
                dr.Close()
                insComm = New SqlCommand(insstr, sqlConn)
                insComm.ExecuteNonQuery()
                ds = Nothing
                Response.Redirect("EntryNewRec.aspx?IssueNumber=" & i)
            Catch ex As Exception
    
            End Try
            
            'obj.closeDatabase()
        End Sub
    and i m hving exception on Response.Redirecte statement

    it says
    The ConnectionString property has not been initialized.

    [InvalidOperationException: The ConnectionString property has not been initialized.]
    Code:
       System.Data.SqlClient.SqlConnection.PermissionDemand() +856947
       System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection) +22
       System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
       System.Data.SqlClient.SqlConnection.Open() +111
       System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
       System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770
       System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +92
       System.Web.UI.WebControls.ListControl.PerformSelect() +31
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
       System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +26
       System.Web.UI.Control.PreRenderRecursiveInternal() +77
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint
    i donno know just before a while it was running good. but now its not running i hvnt even touched that...

    Please help...

    Thanks
    Last edited by Hack; Sep 13th, 2007 at 11:26 AM. Reason: Added Code Tags

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: The ConnectionString property has not been initialized.

    what does "makeConnection" look like?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: The ConnectionString property has not been initialized.

    Quote Originally Posted by musman
    i donno know just before a while it was running good. but now its not running i hvnt even touched that...
    Things don't just change on their own.

    If you haven't done anything, has anything been done to the machine it is being run on?

  4. #4

    Thread Starter
    Member
    Join Date
    Jul 2007
    Posts
    47

    Re: The ConnectionString property has not been initialized.

    i doont think so. coz its a local...

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2007
    Posts
    47

    Re: The ConnectionString property has not been initialized.

    I was missing one connection string in sqldatasource..

    got that...
    Thanks...

Posting Permissions

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



Click Here to Expand Forum to Full Width