Re: ConnectionString property error when viewing form in designer
- From: Jack Jackson <jjackson-nsp@xxxxxxxxxxxxxxxx>
- Date: Tue, 05 May 2009 17:04:54 -0700
On Tue, 05 May 2009 15:05:43 -0700, jmorgret <jmorgret@xxxxxxxxxxxxx>
wrote:
Well, that's just it. I don't see any errors in the code and it
compiles with no errors. So how do I figure out what the problem is? I
go to the lines of code that are referenced in the error I get when
trying to view the form, but there are no errors there.
Here is the entire error message:
The ConnectionString property has not been initialized.
Hide
at System.Data.SqlClient.SqlConnection.PermissionDemand()
at
System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection
outerConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at SPSGData.SPSGDataAdaptor.Fill(SqlDataAdapter thisDataAdaptor, DataSet
thisDataSet) in
C:\ST\Projects\ASATDB\Source\SPSGData\Classes\SPSGDataAdaptor.vb:line
650
at SPSGData.SPSGDataAdaptor.Fill(ReminderSet thisDataSet, String filter)
in C:\ST\Projects\ASATDB\Source\SPSGData\Classes\SPSGDataAdaptor.vb:line
633
at SPSGData.ReminderSet..ctor(String filter) in
C:\ST\Projects\ASATDB\Source\SPSGData\Classes\Reminder\ReminderSet.vb:li
ne 59
at SPSGData.DataTransporter.GetReminderSet(String filter) in
C:\ST\Projects\ASATDB\Source\SPSGData\Classes\DataTransporter.vb:line
149
at SPSGBusiness.DataFactory.GetReminderSet(ReminderFilter filter) in
C:\ST\Projects\ASATDB\Source\SPSGBusiness\Classes\DataFactory.vb:line
147
at SPSGBusiness.ReminderCollection..ctor(ReminderFilter filter, Boolean
headerInformationOnly) in
C:\ST\Projects\ASATDB\Source\SPSGBusiness\Classes\Reminder\ReminderColle
ction.vb:line 95
at SPSGBusiness.ReminderCollection.GetAllReminders(Boolean
headerInformationOnly) in
C:\ST\Projects\ASATDB\Source\SPSGBusiness\Classes\Reminder\ReminderColle
ction.vb:line 14
at ASATDB.ReminderControl.ReminderControl_Load(Object sender, EventArgs
e) in C:\ST\Projects\ASATDB\Source\ASATDB\User Controls\Main
Form\ReminderControl.vb:line 31
at System.Windows.Forms.UserControl.OnLoad(EventArgs e)
at System.Windows.Forms.UserControl.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.ControlCollection.Add(Control value)
at System.Windows.Forms.Form.ControlCollection.Add(Control value)
at
System.Windows.Forms.Design.ControlDesigner.DesignerControlCollection.Ad
d(Control c)
But I don't see anything when I go to those lines.
-Jennifer
That pretty much tells you what is wrong.
In the Load event of a UserControl
(C:\ST\Projects\ASATDB\Source\ASATDB\User Controls\Main
Form\ReminderControl.vb:line 31) you start down a path of calling
methods, eventually ending up trying to fill a dataset, and the
connection information is not set up.
You should not be trying to access your database when executing in the
IDE.
The way I detect if I am running in the IDE is with this code. Since
the GetCurrentProcess call is relatively expensive, I have this method
in my application object, and it caches the result.
Public Shared ReadOnly Property IsDesignMode() As Boolean
Get
If Not m_isDesignModeValid Then
' The following test may fail in some situations,
such as when running under Citrix
' due to insufficient privilege. We assume that
if it fails we are not in design mode.
Try
Dim processName As String =
System.Diagnostics.Process.GetCurrentProcess().ProcessName
If processName = "devenv" OrElse
processName.EndsWith("TestContainer") Then
m_isDesignMode = True
End If
Catch ex As Exception
End Try
m_isDesignModeValid = True
End If
Return m_isDesignMode
End Get
End Property
.
- References:
- Re: ConnectionString property error when viewing form in designer
- From: Jack Jackson
- Re: ConnectionString property error when viewing form in designer
- From: jmorgret
- Re: ConnectionString property error when viewing form in designer
- Prev by Date: Re: ConnectionString property error when viewing form in designer
- Next by Date: Re: ConnectionString property error when viewing form in designer
- Previous by thread: Re: ConnectionString property error when viewing form in designer
- Next by thread: Re: ConnectionString property error when viewing form in designer
- Index(es):
Relevant Pages
|
Loading