|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
what is wrong with thisI 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 got it working
Dim Conn As New SqlConnection("Data source=.\SQLEXPRESS;AttachDbFileName=c:\myDb.mdf;Integrated Security=True;Connect TimeOut=30;User Instance=True") Using Conn Dim queryString As String = "select code, value as Addr from dbo.CodeTable where (codeTableName = 'Company') And (sequence > 0) order by sequence" Dim adapter As New SqlDataAdapter() adapter.SelectCommand = New SqlCommand(queryString, Conn) Dim datatable As New DataTable adapter.Fill(datatable) ComboBoxAddr.DataSource = datatable.DefaultView ComboBoxAddr.DisplayMember = "code" ComboBoxAddr.ValueMember = "Addr" End Using Show quoteHide quote "Gg" <g*@msnews.mailSink.com> wrote in message source=.\SQLEXPRESS;AttachDbFileName=|DataDirectory|\IeStringTmp.mdf;Integranews:OXwpVAgzGHA.2208@TK2MSFTNGP03.phx.gbl... > 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 > Show quoteHide quote > ted Security=True;Connect TimeOut=30;User Instance=True" System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOption> > > > 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 > > s options, Object poolGroupProviderInfo, DbConnectionPool pool, System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConDbConnection > owningObject) > at > Show quoteHide quote > 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 > >
For Next Loop - Manual Might Be Wrong
Changing the text of a Command Button using SetWindowText Is Thread.Abort() blocking until Thread has exited? "If" statement asking for integer Stream Appending text to an array of textboxes how to add dynamic tooltip when dragging scrollbar of datagridview Strange Datagrid Behavior StreamWriter, FileStream throwing uncatchable NullReferenceException C# keyword default(T) to VB.net |
|||||||||||||||||||||||