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
Re: The ConnectionString property has not been initialized.
what does "makeConnection" look like?
-tg
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?
Re: The ConnectionString property has not been initialized.
i doont think so. coz its a local...
Re: The ConnectionString property has not been initialized.
I was missing one connection string in sqldatasource..
got that...
Thanks...