In attempt to file a combo box
I had the following code - copied and modified the suggestion from Cur ( and
thank you Cor) in other thread
Dim Conn As New
OleDb.OleDbConn ection(My.Setti ngs.IeStringTmp ConnectionStrin g &
";Provider=SQLO LEDB")
'Dim Conn As New OleDb.OleDbConn ection("Provide r=SQLOLEDB;Data
Source=.\IeStri ngTmp;user=SA;p asswrod=;")
'Dim Conn As New OleDb.OleDbConn ection("
Dim ad As New OleDb.OleDbData Adapter("select code, value as Addr
from dbo.CodeTable where (codeTableName = 'FinCoUrl') And (sequence 0)
order by sequence", Conn)
Dim dt As New DataTable
ad.Fill(dt)
ComboBoxAddr.Da taSource = dt.DefaultView
ComboBoxAddr.Di splayMember = "code"
ComboBoxAddr.Va lueMember = "Addr"
where My.Settings.IeS tringTmp was created in VS vb project as having the
following value
"Data
source=.\SQLEXP RESS;AttachDbFi leName=|DataDir ectory|\IeStrin gTmp.mdf;Integr a
ted Security=True;C onnect TimeOut=30;User Instance=True"
what I don't understand is the part within the string as |DataDirectory| .
Presumably that is the what is supposed to be the default data directory for
the MDF However I don't think the that is where I created the MDF via VS
VB.net 2005.. Replacing the string with the actual path of the folder for
the mdf file did not help and give me the same error in runtime:
System.Data.Ole Db.OleDbExcepti on was unhandled
ErrorCode=-2147217887
Message="No error message available, result code:
DB_E_ERRORSOCCU RRED(0x80040E21 )."
Source="System. Data"
StackTrace:
at
System.Data.Ole Db.OleDbConnect ionInternal..ct or(OleDbConnect ionString
constr, OleDbConnection connection)
at
System.Data.Ole Db.OleDbConnect ionFactory.Crea teConnection(Db ConnectionOptio n
s options, Object poolGroupProvid erInfo, DbConnectionPoo l pool, DbConnection
owningObject)
at
System.Data.Pro viderBase.DbCon nectionFactory. CreateNonPooled Connection(DbCo n
nection owningConnectio n, DbConnectionPoo lGroup poolGroup)
at
System.Data.Pro viderBase.DbCon nectionFactory. GetConnection(D bConnection
owningConnectio n)
at
System.Data.Pro viderBase.DbCon nectionClosed.O penConnection(D bConnection
outerConnection , DbConnectionFac tory connectionFacto ry)
at System.Data.Ole Db.OleDbConnect ion.Open()
at System.Data.Com mon.DbDataAdapt er.FillInternal (DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Com mon.DbDataAdapt er.Fill(DataTab le[] dataTables,
Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior
behavior)
at System.Data.Com mon.DbDataAdapt er.Fill(DataTab le dataTable)
BTW remote connection , tcpip and named pipe are disabled but local
connection is allowed for the sqlexpress
I had the following code - copied and modified the suggestion from Cur ( and
thank you Cor) in other thread
Dim Conn As New
OleDb.OleDbConn ection(My.Setti ngs.IeStringTmp ConnectionStrin g &
";Provider=SQLO LEDB")
'Dim Conn As New OleDb.OleDbConn ection("Provide r=SQLOLEDB;Data
Source=.\IeStri ngTmp;user=SA;p asswrod=;")
'Dim Conn As New OleDb.OleDbConn ection("
Dim ad As New OleDb.OleDbData Adapter("select code, value as Addr
from dbo.CodeTable where (codeTableName = 'FinCoUrl') And (sequence 0)
order by sequence", Conn)
Dim dt As New DataTable
ad.Fill(dt)
ComboBoxAddr.Da taSource = dt.DefaultView
ComboBoxAddr.Di splayMember = "code"
ComboBoxAddr.Va lueMember = "Addr"
where My.Settings.IeS tringTmp was created in VS vb project as having the
following value
"Data
source=.\SQLEXP RESS;AttachDbFi leName=|DataDir ectory|\IeStrin gTmp.mdf;Integr a
ted Security=True;C onnect TimeOut=30;User Instance=True"
what I don't understand is the part within the string as |DataDirectory| .
Presumably that is the what is supposed to be the default data directory for
the MDF However I don't think the that is where I created the MDF via VS
VB.net 2005.. Replacing the string with the actual path of the folder for
the mdf file did not help and give me the same error in runtime:
System.Data.Ole Db.OleDbExcepti on was unhandled
ErrorCode=-2147217887
Message="No error message available, result code:
DB_E_ERRORSOCCU RRED(0x80040E21 )."
Source="System. Data"
StackTrace:
at
System.Data.Ole Db.OleDbConnect ionInternal..ct or(OleDbConnect ionString
constr, OleDbConnection connection)
at
System.Data.Ole Db.OleDbConnect ionFactory.Crea teConnection(Db ConnectionOptio n
s options, Object poolGroupProvid erInfo, DbConnectionPoo l pool, DbConnection
owningObject)
at
System.Data.Pro viderBase.DbCon nectionFactory. CreateNonPooled Connection(DbCo n
nection owningConnectio n, DbConnectionPoo lGroup poolGroup)
at
System.Data.Pro viderBase.DbCon nectionFactory. GetConnection(D bConnection
owningConnectio n)
at
System.Data.Pro viderBase.DbCon nectionClosed.O penConnection(D bConnection
outerConnection , DbConnectionFac tory connectionFacto ry)
at System.Data.Ole Db.OleDbConnect ion.Open()
at System.Data.Com mon.DbDataAdapt er.FillInternal (DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Com mon.DbDataAdapt er.Fill(DataTab le[] dataTables,
Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior
behavior)
at System.Data.Com mon.DbDataAdapt er.Fill(DataTab le dataTable)
BTW remote connection , tcpip and named pipe are disabled but local
connection is allowed for the sqlexpress
Comment