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 ?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.