|
Always read the data into a Byte[] rather than a Char[] and it will work for both binary and text files. You shouldn't really need to read it into a char[].
Database FAQ
|
|
|
|
|
I wanted to bind the elements in a ComboBox to a column in a DataTable, but wanted them to be sorted. This application is targeted for the Compact Framework, and I didn't see a way to do that directly.
I decided to create a DataView object from the DataTable with the particular sort I was looking for. I set the DataSource of the ComboBox to the DataView, and setup the Display and Value members as needed by the app. Everything seemed to be working as expected, but I have run into one snag I can't seem to solve. If I change the name of one of the colunmns in the DataTable (ultimately the DisplayMember in the ComboBox), it doesn't propogate to the ComboBox by way of the DataView. On the other hand if I add or delete a row to the DataTable, everything does propogate to the ComboBox, even the row where I only changed the name!
Is this the expected behaviour?
Is there something I can do to force the ComboBox to reload it's drop down list?
|
|
|
|
|
This is expected behaviour.
Sadly enough there aren't any event handlers for changing column names in a DataTable object, and I believe they do not show up in the Changes collection either.
You could try re-binding the combobox when a form or control based event fires.
Torin Blair
'In the immortal words of Socrates - "I drank what?".'
|
|
|
|
|
I ended up handling the Underlying DataTable RowChanged event, and as you suggested, re-bound the combobox to the DataView. It seemed so cumbersomb that I thought there must have been a better way.
Thanks for the reply.
|
|
|
|
|
Oops... I hope I didn't mislead you... I'm not changing the column names, I'm changing the content of a column in one of the rows of the DataTable. When I do that, the new value doesn't propogate to the combobox. If I add a new row to the DataTable, everything propogates as I expected.
|
|
|
|
|
I have a VC++ application when executed gives the following message "[Microsoft][ODBC Microsoft Acess Driver]'(unknown)'". How do I fix this?
|
|
|
|
|
Looks like your ODBC connection string may be incorrect. What is it set to?
Affordable and reliable hosting? Click here!
|
|
|
|
|
below is the part where it tries to connect to the data source...and fails to connect
nConnect = SQLDriverConnect( m_hDBC, NULL, psvSource, SQL_NTS, szConnectOutput, sizeof(szConnectOutput), &nResult, SQL_DRIVER_NOPROMPT);
|
|
|
|
|
That looks OK. What is psvSource set to?
Affordable and reliable hosting? Click here!
|
|
|
|
|
_TUCHAR *psvSource=new _TUCHAR[ strlen( svSource )+1 ];
It is really weird. I've also checked in the control panel to see if the MS Access driver was listed as a data source.
May be i can email you the files? I am new to this site. Is there a way to attach the files on this site so u don't have to give your email address to me?
|
|
|
|
|
psvSource needs to be set to a DSN that you have registered in ODBC administrator. If you haven't specified one, that is probablky why you can't connect.
Database FAQ
|
|
|
|
|
Hi all
Please delight me how add store procedure file (*.sql) to my database.
Only way what i find out to add stored procedures is through Server Explorer window, but i yet had an file with ones (been generated third-part tool) and now i want to get acess to procedures which allocated in this file.
Thank.
|
|
|
|
|
Use Query Analyzer to run the script.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I'm using ASP on a IIS server, trying to connect to a MS Access 2000 database.
All is fine until I set a database password, and then IIS tells me "Not a valid password."
I've tried using "PWD=<password>" in the ConnectionString, but the PWD key is for a user password. I found something in the microsoft KB that suggested "DATABASE PWD=<password>" might be the answer, but, alas, IIS still replies "Not a valid password."
Has anyone faced this problem before? Anyone know how to overcome it? (Other than removing the db password)
Thanks in advance for any help.
|
|
|
|
|
|
Hi,
I have a problem, I need to move large numbers of data/multiple tables from a Mainframe DB/2 to a SQL server.
What is the best possible way?
Can I use VB.NET and dataadapers to do this? The larger tables consists of more than 25 milj. rows.
Happy to get any kind of help
Regards
JPalm
|
|
|
|
|
|
Hi,
In a disconnected dataset (dsAdressen) I have to search for a specific record. I want to do this with it's Primary Key (PK).
At designtime I created a connection (cn), dataadapter (daPersonen) and dataset (dsAdressen)
When loading the form I do the following
cn.open
daPersonen.Fill(dsAdressen)
cn.close
When I try to search for a specific record with it's primary key I use code like
dsAdressen.Personen.FindByPersoonsID(1)
When I show the found value in a messagebox it's showing the right record
MsgBox(dsAdressen.Personen.FindByPersoonsID(1).Voornaam)
but my textbox, for which I set the databindings property at designtime in the property pane (txtVoornaam=dsAdressen.Personen.Voornaam), does not show the found value. I thought that by setting this property my textbox should automatically show the found value in the dataset.
I can use code like this to show the value in the textbox, but I should say that is not the way
dim dr ad Datarow
dr = dsAdressen.personen.rows.find(1)
txtVoornaam.text = dr("Voornaam")
I do not understand
Thanks
Hendrik Jan
|
|
|
|
|
Try using a CurrencyManager
Dim cm as CurrencyManager = CType(Me.BindingContext(table), CurrencyManager)
table.DefaultView.Sort = "PrimaryKey"
cm.Position = table.DefaultView.Find(PK)
This should cause value in the selected row to display in the databound TextBox
Darrell A Escola, MCDBA, MCAD
|
|
|
|
|
Is someone know the way to generate Insert script of a couple of selected record in a databae ? To after execute to script on another databse/server ?
sebastien.lachance.blogspot.com
|
|
|
|
|
|
Sorry, I will try again. I have a Select statement that select some records. Then I want to send those record on another database. So I wanted to generate a Insert Script, that "Insert" those record.
My english is not so great, but I try to become better. Sorry.
sebastien.lachance.blogspot.com
|
|
|
|
|
|
Any tutorial/link on developing applications for Windows CE .NET using C#
|
|
|
|
|
I have a table with:
partId, location, quantity.
1 ,a ,12
1 ,b ,10
What is the query to make :
partId, quantity a, quantity b.
1 ,12 ,10
There are only two location, a and b.
Do you get it?
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|