DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   The ConnectionString property has not been initialized (http://www.daniweb.com/forums/thread157510.html)

harsha_abraham Nov 15th, 2008 6:04 am
The ConnectionString property has not been initialized
 
I am getting the following error

“The ConnectionString property has not been initialized’, while executing the below portion of code.checked that the below connection string is having value and not null.

(Data Source=NAWINSQL050;Initial Catalog=AlbatrossDB; Integrated Security=true)


objFormatOut = FormatDepartment.Format.FormatSelectById(m_intOutputFormat, oConn)<—--error occurs(The ConnectionString property has not been initialized’)


in the below section the same stored proc is execurted with out any error.

If m_intOutputFormat = 218 Then
oDS = oDataAccess.ExecuteDataset(oConn, "Stored Procedure", m_intProcYear, m_shtProcMonth, m_strSupplierId, m_strDistId, m_strDestinationCd)

Else
oDS = oDataAccess.ExecuteDataset(oConn, "Stored procedure", m_lngSourceOutputId, m_strSupplierId, m_strDistId,

m_strDestinationCd) <—--same connection string works here in this line and stored procedure executed

End If

Please advise as to what can be the issue and how this can be resolved ?

reena12 Dec 8th, 2008 7:07 am
Re: The ConnectionString property has not been initialized
 
Hi,
oConn.open() statement is missing

(Data Source=NAWINSQL050;Initial Catalog=AlbatrossDB; Integrated Security=true)

oConn.open()

objFormatOut = FormatDepartment.Format.FormatSelectById(m_intOutputFormat, oConn)

If m_intOutputFormat = 218 Then
oDS = oDataAccess.ExecuteDataset(oConn, "Stored Procedure", m_intProcYear, m_shtProcMonth, m_strSupplierId, m_strDistId, m_strDestinationCd)

Else
oDS = oDataAccess.ExecuteDataset(oConn, "Stored procedure", m_lngSourceOutputId, m_strSupplierId, m_strDistId,

m_strDestinationCd)

End If


All times are GMT -4. The time now is 11:20 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC