|
ADO, yes. Is there a reason that you are wanting DAO? I'm not that familiar with those methods (DAO) to access data. I would have to assume that there is some partiular reason as to why you would want to use DAO because Microsoft recommends ADO (probably ADO.NET now) as the currently best method for database access.
Nick Parker
|
|
|
|
|
How i can return Recorset* variable, from COM+ object, written on VC.NET. Record to idl file not helps me.
|
|
|
|
|
Cannot help you with .NET, but I know how to do it in VS6 Maybe it can help you.
Actually you need to return a VARIANT , so other languages, like VB or VBScript can use it also. The code will look like this:
HRESULT GetRecordest(VARIANT * pResult){
....
<font color=green>
...
pResult->vt = VT_DISPATCH;
pResult->pdispVal = (IDispatch*)piRecordset;
return S_OK;
}
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
(To start, I am a C++ expert but database novice.)
There is a table in one of our databases that really bugs me.
Table A has a column containing an ID. Several rows can use that ID.
Table B also has an ID column with several rows using the same ID.
Table C was created with nothing but a column of ID so both A and B have a one to many relationship with it.
It is table C that bugs me. It's not just unaesthetic, it has a problem: if ALL the rows in Table A are deleted that reference a specific ID, all the rows in Table B need to be deleted as well.
More importantly, all the rows in table B that use a specific ID CANNOT be deleted if there is a single row in in Table A that references that ID (there MUST be at least one row in Table B containing that ID.)
Is there a way to create a constraint so table C can be eliminated?
Right now the table is in Oracle 7&8, though it's going to be in something, anything, else inside two months (Oracle licensing is killing us and Oracle has a very serious bug with connections that keeps biting us), probably SQL Server.
|
|
|
|
|
I'm a total newbie w/ SQL so i'm hoping I explain myself properly.
I have a table called 'addresses' which looks like this:
-----------------------------------------------------
ID Categorey Name Address
-----------------------------------------------------
categorey field can be one of the following:
1) Friend
2) Employee
3) Family
4) Other
If I wanted to query a database returning only those records with 'friend' and 'family' under categorey and the name I was searching for was
Ed but the query should return all likely matches if nothing was exact...?
So if Ed wasn't found...
Eddie
Eddy
Edward
etc...would be returned...
Can this be acocmplished in SQL or would I have to query the entire DB and sort though the recordsets manually...?
Thanx in advance.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
Ed but the query should return all likely matches if nothing was exact...?
"SELECT friend,family FROM addresses WHERE friends LIKE 'Ed%'"
This would return Ed and Eddie,Eddy,Edward.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Coolness
Thanx a lot!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Only one question
Why is friend plural after WHERE clause...?
Is thisa typo or a MUST...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
Why is friend plural after WHERE clause...?
Is thisa typo or a MUST...?
Thats my mistake in typing,it should be exactly the same as your column name.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Mazdak is correct in that if you simply want to search for all entries where wildcards can be used as substitutes for characters, then you can use the LIKE predicate. However, if your needs are a bit more complex where you need to find sematically similar names like Richard=Dick or Tom=Thomas then you'll need to use SQL Server Full Text Indexing. If that's the case, let me know as I wrote an article for another site a couple of years ago. If you need it, I'll find it and send it to you.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Tom Archer wrote:
if your needs are a bit more complex where you need to find sematically similar names like Richard=Dick or Tom=Thomas then you'll need to use SQL Server Full Text Indexing.
I'm intrested in that Tom,Would you please send it for me?
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Tom Archer wrote:
you'll need to use SQL Server Full Text Indexing. If that's the case, let me know as I wrote an article for another site a couple of years ago. If you need it, I'll find it and send it to you.
Tom, I too am interested in this, I write a lot of search utilities at work and this sounds interesting. Please send if you can find it. Thanks.
Nick Parker
|
|
|
|
|
SQL can do that...?
Wow thats pretty cool...how would it know Dick is an alternative to Richard...?
You would have to create a database for such things no...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi,
First off, I'm using VC6 with the latest service pack and MDAC 2.6/2.7.
I imported the ADO DLL.
I have successfully got an app to talk to any database (via a connection string and OLEDB/ODBC) and I can place resulting recordset results into the DataGrid via use of the SetRefDataSource method.
However, the DataGrid only accepts the ADO rs if it is disconnected.
What I want to do (and I don't know if it's poss, but it sounds like it should be) is to query the database, keep the rs connected, set it into the DataGrid and further results be pulled in as (and when) the user scrolls down the results.
I want this as some of our queries take some time and could return millions of rows. It would be nicer to respond quickly pulling back enough data to show in the grid and pull more results as the user scrolls.
Is this possible? If so, how might I go about doing it?
Thanks,
Simon
|
|
|
|
|
Howdy,
I have to write a WinNT(4) service which checks a few directories and writes files to a database.
The database is MS Access & it is accessed directly (ie not through ODBC) so I'd normally use AppWizard in VC to make an MFC with db support program. However, given that its an NT service, I'm writing it as a console application.
1) If I make it a console app with MFC support, does that blow the size of the thing sky high?
2) Can I access an MS Access database easily without using MFC functionality ?
3) Am I approaching this the correct way.
Thanks for any help,
Damian Del Campo
|
|
|
|
|
i am using C#, but this problem is language independant
i send a row from a dataset (dataset.getTable().Rows[x]) to a form that then displays that row in unbound controls. That form has a navigate forward and back button.
how do i find out the row's index in a dataset so that i may 'movenext' or even iterate from that point? the problem is that the form does not know the row index and it cannot call back to the owner form.
burnt
|
|
|
|
|
I think you have either got a problem of "who owns what data" here, or it's as simple as you don't store that 'x' (telling what row it is) in the appropriate place.
|
|
|
|
|
well, the dialog owns the dataset once it is invoked. the fact is, im not even using 'x'. the RowData is found through primary keys in dataset.find(). so i never really know what index rowdata is at.
the init() function of the dialog takes the rowdata and the dataset it came from. i need to nav using that info.
|
|
|
|
|
Unless you are the single user of that database, there is AFAIK no other way to solve your problem than to
1) use a versioning DB (e.g. Firebird at SourceForge)
or
2) create a temp-table with the results from your select.
You can't really iterate a (non-versioning) RDBMS. You can get a snapshot.
|
|
|
|
|
what does versioning have to do with simply getting the next row of a dataset object? its in memory, not cursored to the actual database and very much unbound. for all you care, i could be creating the dataset in memory from no db at all.
the question is, and remains, how do i get the index of a row in a dataset given a DataRow object, and a DataSet object, and NOT the index of the current RowData object.
if i can say dataset.Table().rows[20] and get a DataRow object, shouldnt i be able to easily code dataset.Table().rows[_row.Index + 1] ?
|
|
|
|
|
How can I get the following SQL statement to take a string value after FROM.
SqlString = "SELECT * "
"FROM ?????";
The string name is strFolderOpen and this will hold the name of the Access database to open.
Thanks, Aoife
|
|
|
|
|
What language are you doing this in, VB, Javascript, C++
This should do it in VB:
<code>
SqlString = "Select * From '" & strFolderOpen & "'"
</code>
Let me know...
HTH
Nick Parker
|
|
|
|
|
What design would be more efficient...?
I have 6 tables:
1) Hardware
2) Software
3) Programming
4) Networking
5) Database
6) Technologies
Each table has Word, Description field(s). Is this a normalized DB or would it be better to....
New Table:
===============================================
PrimaryKeyID | Categorey | Word | Description |
===============================================
This way they are all stored inside the same table and instead of searching seperate tables for the word, I search only based on Categorey...?
Is this possible in SQL...?
I personally feel the second approach is probably better and faster, but i'd like a opinion...cuz i've already designed it the first way however i'll redo it if the second is better.
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
OK - the first way is flawed for two reasons:
1. You're relying on the program knowing the names of all the tables.
2. You'd have to change the program if you added a new table.
SO - my solution would be this (_x_ = primary key):
tblCategories ( _ID_, Name )
tblWords ( _ID_, CatID, Word, Description )
Then, to list categories use SELECT * FROM tblCategories.
To list items in a specific category:
SELECT * FROM tblWords WHERE CatID=[your category ID]
To create a new category:
INSERT INTO tblCategories (Name) VALUES ("Test")
because ID would be an autonumber. You get the idea anyway, and that's properly normalised too.
--
Andrew.
|
|
|
|
|
Thanx for the response...
I've re-done what I originally had into something like
Table
==================================
ID - Category - Word - Description
Not quite what you've suggested, but is it not similar and atleast better than my first approach...?
Thanx again!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|