G
Gg
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.OleDbConnection(My.Settings.IeStringTmpConnectionString &
";Provider=SQLOLEDB")
'Dim Conn As New OleDb.OleDbConnection("Provider=SQLOLEDB;Data
Source=.\IeStringTmp;user=SA;passwrod=;")
'Dim Conn As New OleDb.OleDbConnection("
Dim ad As New OleDb.OleDbDataAdapter("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.DataSource = dt.DefaultView
ComboBoxAddr.DisplayMember = "code"
ComboBoxAddr.ValueMember = "Addr"
where My.Settings.IeStringTmp was created in VS vb project as having the
following value
"Data
source=.\SQLEXPRESS;AttachDbFileName=|DataDirectory|\IeStringTmp.mdf;Integra
ted Security=True;Connect 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.OleDb.OleDbException was unhandled
ErrorCode=-2147217887
Message="No error message available, result code:
DB_E_ERRORSOCCURRED(0x80040E21)."
Source="System.Data"
StackTrace:
at
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString
constr, OleDbConnection connection)
at
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOption
s options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbCon
nection owningConnection, DbConnectionPoolGroup poolGroup)
at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
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(DataTable[] dataTables,
Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior
behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable 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.OleDbConnection(My.Settings.IeStringTmpConnectionString &
";Provider=SQLOLEDB")
'Dim Conn As New OleDb.OleDbConnection("Provider=SQLOLEDB;Data
Source=.\IeStringTmp;user=SA;passwrod=;")
'Dim Conn As New OleDb.OleDbConnection("
Dim ad As New OleDb.OleDbDataAdapter("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.DataSource = dt.DefaultView
ComboBoxAddr.DisplayMember = "code"
ComboBoxAddr.ValueMember = "Addr"
where My.Settings.IeStringTmp was created in VS vb project as having the
following value
"Data
source=.\SQLEXPRESS;AttachDbFileName=|DataDirectory|\IeStringTmp.mdf;Integra
ted Security=True;Connect 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.OleDb.OleDbException was unhandled
ErrorCode=-2147217887
Message="No error message available, result code:
DB_E_ERRORSOCCURRED(0x80040E21)."
Source="System.Data"
StackTrace:
at
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString
constr, OleDbConnection connection)
at
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOption
s options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbCon
nection owningConnection, DbConnectionPoolGroup poolGroup)
at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
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(DataTable[] dataTables,
Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior
behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
BTW remote connection , tcpip and named pipe are disabled but local
connection is allowed for the sqlexpress