|
The quick answer is to use the DataAdaptor as follows:
myDataAdaptor.Update(myDataSet.myTable.Select(null, null, DataViewRowState.Deleted));
DataViewRowState.Deleted can of course also be changed for other rowstate based selections such as added/modified.
If you end up using these in a sequence and have related tables then note that you should also do the updates in a specific order between parent and child tables: delete child rows, add parent rows, modify parent rows, add child rows, modify child row etc.
It gets more fun if you have a whole hiearchy of tables....
Hope this helps.
|
|
|
|
|
Hi,
I want to store in database (ms-access), and display some non-English content in the web site (Arabic). The database stores the english and arabic contents in it. It will pick the respective contents on the user's selection policy.
I made changes at the ASP to make language charset as follows...
ARABIC -
ENGLISH -
And the fonts looks fine when it is seen from MS access. But when I show that in the web-site, it JUST shows as ?????.
What can be the 'missing factor' to make the arabic text look on the site.
Any tag to be added at the asp page to make the site show good with the arabic fonts from the ms-access?
Thanks in advance!
I was born intelligent Education ruined me!.
|
|
|
|
|
I am tring to develope a source code storage app and I can't
figure out how to design the db so that code belongs to a category
of a category. Nested I guess is the word I am looking for.
If I add a category on a tree view and then add a subcategory
how do I create the db and also adding and updating.
This is my first try
one table named sourcecodeinfo and second table named sourcecode
sourcecodeinfo columns
id
category
created
updated
sourcecode columns
id
code
notes
type
the category column has one to many relation like dataaccesscode
then a bunch of code snippets that relate to dataaccess.
But what if I have a category named DataAccess and subcategory
named updates or whatever?
How is this done?
I don't want someone to do the work for me I would like to learn how
myself. I hate it when someone says provide code and thats all they
want and then someone does and then they say I need it in VB or C#.
They want people to do the work for them.
Thank You
Bo Hunter
|
|
|
|
|
You can create another table that describes categories, for example:
id - category id
parent_id - the parent category
name - the name of the category
Your sourcecodeinfo table would then reference a category ID.
- Mike
|
|
|
|
|
Well Mike I feal dummer than dumb. That is too easy.
Thank You very much.
I have done alot of sql and none of oledb
even though they are somewhat the same there
are some differences. Not that has anything
to do with this.
Bo Hunter
|
|
|
|
|
|
Assuming that this is a SYSTEM DSN, you can look up the registry value named Database under the key HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\{DSN_NAME}
If it has been defined, the DSN DB will be stored under this value.
|
|
|
|
|
Hi,
I was trying to open the IRowsetIndex interface with
OpenRowset function.
The code I have used is similar to the example
in "Chapter 11: Integrated Indexes" in MSDN Library.
With Jet4.0 it works fine.
On SQL Server 2000, next functions returns DB_E_NOINDEX.
hr = pOpenRowset-OpenRowset(
NULL,
&TableID,
&IndexID,
IID_IRowsetIndex,
1,
rgPropSet,
(IUnknown **)&pRowsetIndex);
The index was verified and it exists attached to the SQL
Server table.
How can I work with indexes on SQL Server?
I can create and drop indexes with OLE DB technology but I cannot use them.
Any idea will be appreciated.
Thanks in advance.
Mike Martin
|
|
|
|
|
hi
i have binded a set of textboxes to a DataSet and when i change the value in the textbox the value in the dataset also updating but the RowSate remains 'Unchanged' so when i invoke the OleDbAdapter.Update method it doesn't recognize any changes so the meta data in the datasource remains unchanged
maybe the DataSet do AcceptChanges() Automaticly when i change the value of the binded textbox?
can you help?
-- Directly From Zion --
------ Haimon15 ------
|
|
|
|
|
Are you working in Web Forms or in Windows Forms?
|
|
|
|
|
im working in windows forms
-- Directly From Zion --
------ Haimon15 ------
|
|
|
|
|
Sorry I didn't reply sooner -- I was hoping you'd say "web forms" -- in which case the answer is that databinding in web forms doesn't trigger any methods that tell you if the data changed or allow automatic updating of a dataset. I'm afraid I haven't spent enough time on windows form design and data binding to help much here.
|
|
|
|
|
Greetings my dear fellow programmers,
I have a situation!
I need to create a ADODB Stream object in VC++.
How can i do it?
Nuno Henrique Mendes
|
|
|
|
|
I have Master-Detail datagrid. The detail datagrid is embedded in the Master datagrid. In the detail datagrid I want to implement paging ,sorting etc. I have addes the event handlers delegates manually. For some reason the pageindexchanged or sort events for the detail datagrid. Does anyone know of this behaviour? I saw a lot Master-Details datagrids on the internet, nobody seems to have implemented paging-sorting for details grid embedded within a datagrid. thanks
Madhuri Mittal
|
|
|
|
|
Hiya can someone please give me a working example of connecting to an SQL database using ADO and accessing the contents.
I tried tried it myself but I keep getting a system error.
Thanks a million.
|
|
|
|
|
How are you trying to connect? through an ASP.NET page, through a VBA Application.
Please post your code if the site permits that, I'm not sure.
grahamoj wrote:
connecting to an SQL database using ADO and accessing the contents
|
|
|
|
|
To tell you the truth not too sure. Only learning ADO a few days but already it is driving me mad connecting to the SQL server I have.
Here is my code:
try
{
HRESULT hResult;
if(FAILED(::CoInitialize(NULL)))
return;
_ConnectionPtr pConnection;
hResult = pConnection.CreateInstance(__uuidof(Connection));
hResult = pConnection->Open(_T("Provider=SQLOLEDB.1; Data Source=(local);Initial Catalog=Branch;Trusted_Connection=yes;"),
_T(""),
_T(""),
adOpenUnspecified);
}
catch(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bs = _bstr_t(" Error: ") + _bstr_t(e.Error()) + _bstr_t(" Msg: ")
+ _bstr_t(e.ErrorMessage()) + _bstr_t(" Description: ")
+ _bstr_t(e.Description());
MessageBox(0,bs,bstrSource, MB_OK);
}
I didn't think I needed to login once I used the Trusted Connection=yes. could you plz have a quick look and tell me what I am doing wrong. Once I can get the connection, I should be ok.
Oh and Branch is the name of my database.
Thanks.
|
|
|
|
|
http://www.connectionstrings.com/
Go to this URL for all different SQl Connection Strings.
HTH
|
|
|
|
|
hey this is question for DB specially SQL Server experts
i have 2 quetions.
1) i have a field in table which is of 215 bytes. i have about 1.1 Million records in my table. I noticed that only 20,000 records of these 1.1 Million records require more than 50 Bytes for that field. Now if partition my table in two so that one table has field length of 50 while other has of 215, will there be any performance gain in terms of speed and memory? i am not talking in terms of normalization ( just performance) and how much do u think will be performance gain if any?
2) After any qury on SQL server, its memory usage goes to its maximum allowed memory usage ( my minimum is 0), but when query has ended memory usage still remains the same. is there any way to overcome this problem?
Thanx in advance!!
Shoaib
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
M.Shoaib Khan wrote:
Now if partition my table in two so that one table has field length of 50 while other has of 215, will there be any performance gain in terms of speed and memory?
Shoaib,
This is! a method of normalization as far as I can see.
And the answer is yes, you would boost the performance level of your queries if you were to do the above.
|
|
|
|
|
I obviously haven't been using ADO very long, but I'm sure there's a better way to accomplish this. I have a table to maintain - a list of committee names and chairpersons sorted by year served called, oddly enough, Chairs. I want to display them and allow selection of one record for editing. The table contains only the index of the matching entry in another table for the committee names (Comms) and chairpersons (People). The brute force method I'm attempting now chugs through the records in Chairs for each year, extracts the index for each person and committee, then performs individual queries to retrieve text data from the Comms and People tables for display on a web page. That seems like an awful lot of queries to perform such a simple task. Is there a smarter way to do this that doesn't require so many trips back to the database?
[EDIT] It's an Access DB because of various limitations - SQL Server and MySQL are not available - so I'm limited in what tools are usable. [/EDIT]
"Ask not for whom the bell tolls; It tolls for thee..."
|
|
|
|
|
Its sounds like you are on the right track, with a normalize table(Chairs). Why not just preform the join to the other two tables? Like such: SELECT {WHATEVER} FROM Chairs as c, Comms as Com, People as p WHERE c.FK_PeopleID = p.PK_peopleID AND c.FK_CommsID = com.PK_CommsID AND [Whatever time constraints for the chairs table here]
Although this SQL may not be the answer your are looking for, I think that given your boggle the best solution is a one sql solution, which will then require only a sigle trip to Access.
|
|
|
|
|
That's the approach I was looking for, but I haven't used a JOIN before. I usually let Access do it, and don't know how the SQL should be structured. I really need a decent SQL reference! Thanks for the idea!
"Ask not for whom the bell tolls; It tolls for thee..."
|
|
|
|
|
When I input my first entry in a dataset with an autoincrement field, it starts at 0. When I do the same thing in MySQL, it starts at 1. How do I reconcile the difference?
Thanks
|
|
|
|
|
I am having trouble getting table constraints to work the way I think they should. I have unique constraints set up for two fields of a three field table, and when I add a row to the table, I was hoping the constraints would be honored at that time. I want the new row to have unique values in the fields for the entire column in the table. Here is what I am setting up:
private OdbcDataAdapter keyvalueDA;
.
.
.
keyvalueDA = new OdbcDataAdapter
("SELECT value_id, value, valuehash FROM keyvalue", conn);
keyvalueDACmdBuilder = new OdbcCommandBuilder(keyvalueDA);
keyvalueDA.FillSchema(ds, SchemaType.Source, "keyvalue" );
.
.
keyvalueDA.Fill(ds, "keyvalue");
.
.
.
// Now in a method, I insert the new values in the table.
DataTable myTable = ds.Tables[tableName];
myDataRow = myTable.NewRow();
myDataRow["value"] = valuepassedin1;
myDataRow["valuehash"] = valuepassedin2;
// and then call
myTable.Rows.Add(myDataRow);
At this point I would expect since valuehash is set to be unique, that if I tried to enter a duplicate, it would complain here.
It does not.
I get no indication of a problem until I try to update the dataset into the real database
keyvalueDA.Update(ds, "keyvalue");
which then throws an exception, duplicate key entry.
When I look at the dataset, it shows that the unique constraints are being enforced
in dataset:
enforceConstraints true bool
Do I need to explicitly set the constraints for the "new row" before I add it to the table?
|
|
|
|