473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

what is wrong with this

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.IeStringTmpConne ctionString &
";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=|DataDirector y|\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(Ol eDbConnectionString
constr, OleDbConnection connection)
at
System.Data.OleDb.OleDbConnectionFactory.CreateCon nection(DbConnectionOption
s options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.Creat eNonPooledConnection(DbCon
nection owningConnection, DbConnectionPoolGroup poolGroup)
at
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(Data Set 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
Sep 1 '06 #1
1 6230
GS
I got it working
Dim Conn As New SqlConnection("Data
source=.\SQLEXPRESS;AttachDbFileName=c:\myDb.mdf;I ntegrated
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

"Gg" <gg@msnews.mailSink.comwrote in message
news:OX**************@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.IeStringTmpConne ctionString &
";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=|DataDirector y|\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(Ol eDbConnectionString
constr, OleDbConnection connection)
at
System.Data.OleDb.OleDbConnectionFactory.CreateCon nection(DbConnectionOption
s options, Object poolGroupProviderInfo, DbConnectionPool pool,
DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.Creat eNonPooledConnection(DbCon
nection owningConnection, DbConnectionPoolGroup poolGroup)
at
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(Data Set 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


Sep 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mike Henley | last post by:
I first came across rebol a while ago; it seemed interesting but then i was put off by its proprietary nature, although the core of the language is a free download. Recently however, i can't...
72
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
28
by: Madhur | last post by:
Hello what about this nice way to open a file in single line rather than using if and else. #include<stdio.h> void main() { FILE *nd; clrscr();...
9
by: Pyenos | last post by:
import cPickle, shelve could someone tell me what things are wrong with my code? class progress: PROGRESS_TABLE_ACTIONS= DEFAULT_PROGRESS_DATA_FILE="progress_data" PROGRESS_OUTCOMES=
3
by: Siong.Ong | last post by:
Dear all, my PHP aims to update a MySQL database by selecting record one by one and modify then save. Here are my PHP, but I found that it doesnt work as it supposed to be, for example, when...
89
by: Tubular Technician | last post by:
Hello, World! Reading this group for some time I came to the conclusion that people here are split into several fractions regarding size_t, including, but not limited to, * size_t is the...
20
by: Daniel.C | last post by:
Hello. I just copied this code from my book with no modification : #include <stdio.h> /* count characters in input; 1st version */ main() { long nc; nc = 0;
24
by: MU | last post by:
Hello I have some code that sets a dropdownlist control with a parameter from the querystring. However, when the querystring is empty, I get an error. Here is my code: Protected Sub...
2
by: mingke | last post by:
Hi... So I have problem with my if condition..I don't know what's wrong but it keeps resulting the wrong answer.... So here's the part of my code I have problem with: for (i=0; i<size2;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.