|
Hi everyone!
How to save a dataset as a new .mdb file.
Thank you!
|
|
|
|
|
I don't think you can do it. I've tried to before and didn't find a way to do it.
There's not much to handle mdb files in c#, for instance I needed to use reflection to compact database, so maybe you can do it the same way.
Anyhow there is a simpler way, you can store an empty mdb on you application as a resource and you deploy it when you need it. After that you can connect with it via OleDB andd then you can store handle it as any other database that you can connect to using OleDB.
Regards.
|
|
|
|
|
Hi,
First, you'd need to explain what kind of .mdb-file you want. The file-extension is used by Sql Server and Access, two different types of databases. I'd be assuming Access.
First part would be getting a new db on the target-system. The easiest way to do this with Access is by adding an empty db-file as an embedded resource.
Second part would be writing the data to the new database. That would be done using OleDb[^].
I are Troll
|
|
|
|
|
Hi Troll
Thank you for replying.
I have a datset filled with a table, and i need to export this table as a new access database.
|
|
|
|
|
shoubi wrote: I have a datset filled with a table, and i need to export this table as a new access database.
Start by creating an empty Access database. Then try creating an OleDb connection as suggested, and write the dataset to the database.
You can always get help with specific questions here if you get stuck midway
I are Troll
|
|
|
|
|
Hi Troll
Thank you! i manage to do it! however i need to check for duplication of records. I have a dataset to insert into the database. How do i check for duplicate records. let say if the record has existed in the database then it will not be inserted.
Thanks for reading!
zheng
|
|
|
|
|
shoubi wrote: Thank you! i manage to do it!
My pleasure, and good job
shoubi wrote: let say if the record has existed in the database then it will not be inserted.
That's the job of the <ocde>Primary Key[^].
As an example, a single person would be uniquely identified by his/her social security number, so we could make that our primary key. That would make the database guard against duplicates in that table, based on the contents of the "social security number"-field.
Another way to prevent duplicates would be using the UNIQUE [^]-constraint.
I are Troll
|
|
|
|
|
hi troll
how to transfer values from one datatable to another datatable. For example there are 2 datatables Table A and Table B. If then column name in Table A is the same as Table B then all the values of that column will go into Table B of the same column name.
Hope you understand me.
Thank you
zheng
|
|
|
|
|
|
hi troll
thank you for replying i would like to copy values of a column in the dataset to another column in another dataset. the condition is: if the both column name is the same.
thank you!
|
|
|
|
|
shoubi wrote: the condition is: if the both column name is the same
..and do you know how to check that?
I are Troll
|
|
|
|
|
hi troll
thank you for your help... i managed to do it!
thank you!
zheng
|
|
|
|
|
shoubi wrote: thank you for your help... i managed to do it!
I wasn't much help, so the credit is yours - well done
I are Troll
|
|
|
|
|
hi troll
i need your help again. how do i insert the dataset into the database.
here is my code:
string SelectSchema = "SELECT * FROM [Package Data Range]";
DataSet ds = new DataSet();
OleDbDataAdapter adapterPkInfo = new OleDbDataAdapter(SelectSchema, ImportCon);
adapterPkInfo.FillSchema(ds, SchemaType.Source, "PackageDataRangeSchema");
DataSet ds2 = new DataSet();
string selectPkInfo = "SELECT * FROM [Package Data Range]";
OleDbDataAdapter adapter = new OleDbDataAdapter(selectPkInfo, connection);
adapter.Fill(ds2, "Package Data Range");
ds.Tables[0].Merge(ds2.Tables[0],true,MissingSchemaAction.Ignore);
i would like to insert the dataset ds into the database.
thank you
zheng
|
|
|
|
|
hi troll
I have another question, however it is not related to this. Hope you can give me your professional advice.
I have a C# dll, I want to call it from a C++ program. How do I import this dll into the C++.
thank you
|
|
|
|
|
shoubi wrote: I have another question, however it is not related to this.
No problem, but you would have gotten more reactions if you created a new post.
shoubi wrote: How do I import this dll into the C++
Using a Platform Invoke[^] would be the easy way to call unmanaged code. If you want to wrap an existing unmanaged type, then look here[^].
Enjoy
I are Troll
|
|
|
|
|
Hi,
I need to notify any exception in the worker thread to the main/ calling thread. How to achieve this and what is the best way to do it.
Googled around and came to know that the exceptions in the worker thread are not handled by the main thread.
Thanks,
Praveen Raghuvanshi
Software Engineer,
India.
|
|
|
|
|
Hi,
You can use 'Application.ThreadException'. it will handle any unhandled exception that raises in a sub-thread, anyway this only allows you to have a application wide event for handling all your sub-threads. Maybe you can create an event yourself and call it on the catch block. This way you control the exceptions on the sub-thread and send it to UI thread.
Hope this helps.
|
|
|
|
|
Thanks Gonzalo!
I have tried above mentioned event mechanism. Just thought of something better available.
Praveen Raghuvanshi
Software Engineer,
India.
|
|
|
|
|
You welcome .
I guess then the only way would be you taking care of picking the expcetion in the sub-thread and moving it to UI manually.
Regards.
|
|
|
|
|
Hello.
In the database tree structure of how to write?
After the move in the C#
|
|
|
|
|
From your description of the problem, no.
Please clarify your question - in English it does not make a lot of sense...
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Hello.
In the database tree structure of how to write?
After the move in the C#
|
|
|
|
|
Can you please give some detail, so that it is easier to answer your question.
And please don't cross post. Read this[^] guideline before you post your question.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hi,
I am building a GPS assisted application, which is to display a weather forecast for the closest location with reference to current location.
I am using yahoo weather forecasts.
What i have done:
1. I can successfully request a weather for a place if i know its WOEID (Note: only some places have weather forecasts).
2. In order to get a WOEID of the current location i can query "FLICKR" using YQL and passing current latitude and longitude and get a WOEID back for that place.
Problem:
Is there any way i can request a weather forecast for a nearest location to acquired WOEID of current location.
Thank you in advance,
|
|
|
|