|
Read the OLEDB 2.0 Reference guide. The interfaces that are mandatory should be supported by the custom OLE DB provider. A client should simply create an instance of data source object using CoCreateInstance etc, then obtaing the data source initialization interface. After that its simple COM programming to trace through various interfaces using QueryInterface etc. But you must refer to the custom provider documentation for which optional interfaces are exposed.
|
|
|
|
|
Hi,
I am trying to set up my database with the table storage and the index storage in seperate filegroups. To do this I am trying the following SQL :
CREATE TABLE ClosingArea (
ClosingArea_ID INTEGER NOT NULL,
ClosingArea_Name VARCHAR(64)
) ON MM32TABLES;
ALTER TABLE ClosingArea ADD CONSTRAINT CLOSINGAREA_PK PRIMARY KEY (ClosingArea_ID) ON MM32INDEXES;
However this initially creates the table in the MM32TABLES filegroup but the "ALTER TABLE" statement changes the table storage to MM32INDEXES when I obviously only want to store the index in that filegroup.
Any ideas why this is happening or how I can do what I want ?
thanks in advance.
|
|
|
|
|
This is because the table and primary key (or clustered index) have to be on the same filegroup. You can create a table on the MM32TABLES group and then create a non-clustered index on MM32INDEXES.
Jason Cono, MCSD
|
|
|
|
|
I am trying to write an out of process com server that is capable of passing back to the client over the network a _ConnectionPtr. It is really a simple 2-tier application. But although the pointer I am getting back looks valid I get an error when I try and open a recordset using the connection returned.
Can anybody help.
I can post some sample code if that would help.
Cheers
AndyC
|
|
|
|
|
Thank you!
I need to allow upwards of 10 District Managers remote access to an Access Database. These Managers will be spread out across Canada. Would it make sense to use an ASP or to use some software like PCAnywhere?
I am kinda stuck and would appreciate any help you can offer.
Thank you so much,
Josie Marent
|
|
|
|
|
Well, both ASP and PCAnywhere could be good solutions.
If you use PCAnywhere you need to write your application in access, because all the users would be using remote control of your server.
With ASP you need to write the application using Active Server Pages, so I guess it depends on what you know most about.
If security is a great consern for you, and the users access the app. using the internet, I would go for ASP, maybe using a SSL connection to encrypt the pages.
If a hacker hacks your webserver he have a harder job taking over your server, than if he hacks a server running PCAnywhere...
- Anders
|
|
|
|
|
Hi all,
I'm using ADO for accessing a MS Access database file in a DLL. I then use this DLL in my application. The problem happens when I try to start any NT service (for ex, IIS Admin Service) and my application at the same time: my application seems to hang forever. I put some debug logging and find out that it get stuck in a function _RecordsetPtr->Open(...), I then try to use _ConnectionPtr instead, it also get stuck in _ConnectionPtr->Open(...). I am very confused and I don't know what's going on. Have anyone encountered this problem before? Please help.
Thank a lot,
Rocky
|
|
|
|
|
Visual C++ 6.0, sp5
NT4, sp5
I'm working on an app that uses ADO to access an oracle database. The following code is part of the function that opens a recordset (try/catch stuff removed for the sake of brevity):
Fields* m_pFields = NULL;
SAFE_CALL(m_piRecordSet->Open(vSQL, vConnection, adOpenDynamic, adLockOptimistic, adCmdText));
int m_nRecordCount = m_piRecordSet->GetRecordCount();
SAFE_CALL(m_piRecordSet->get_Fields(&m_pFields));
...and this is a code snippet from the function we use to close the recordset:
if (m_pFields)
{
m_pFields->Release();
}
SAFE_CALL(m_piRecordSet->Close());
m_piRecordSet.Release();
m_piRecordSet = NULL;
The problem is with the m_pFields variable.
The first 10 or so times we call the function containing this code, it's a valid pointer. On or about the nth time, the variable is NULL. Actually "not initialized" would be a better description of it's state, because if we don't set it to NULL before calling the get_Fields() function, it's value is 0xcccccccc.
As far as I can tell, we close the recordset when we're done with it. Otherwise, we'd get an error message from Oracle saying we have too many open cursors.
Has anyone got any idea why this might be happening?
|
|
|
|
|
Hi,
I use Visual C++ 6.0 SP 4 , SQL Server and oledb
I create a class to connect to my database. In my constructor i initialize com library like this :
CoInitialize(NULL);
In my destructor i release com library like this :
CoUninitialize();
If i use this class to execute for exemple an sql query ( store procedure), my functions open, execute, close,... work.
But if i close my application ( OnOK ) , two seconds later i obtain the following acces violation message :
EXCEPTION(c0000005 acces,@40f919) EBP184f0b8 EIP40f919)
ASM 45 fc 8b 08 8b 01 52 ff 50 08 8b e5 5d c3 cc cc cc cc cc cc
EAX:184f618 EBX:dc0110 ECX:383439 EDX:383439 ESI:dc0064 EDI:184f664 ESP:184f0b4
The suspect function is _Release() throw() which is in a Visual C++ include file ( in Include\COMIP.H )
// Releases only if the interface is not null.
// The interface is not set to NULL.
void _Release() throw()
{
if (m_pInterface != NULL) {
m_pInterface->Release();
}
}
But if i comment out CoUninitialize() instruction, my code work without acces violation.
Can anybody help me?
Best regards,
Cheickna
|
|
|
|
|
Yeah, I think, the problem is the following: when you call a destructor, the code within the destructor is executed, then the destructors of the base classes (reverse order of constructors). So when a base class calls Release or any COM function, the Com Library is not available any more and the code GPFs.
I solved the problem like this:
struct ComStarter {
ComStarter() { CoInitialize(NULL); }
~ComStarter() { CoUninitialize(); CoFreeUnusedLibraries(); }
}
class MyConnection: public ComStarter, public _ConnectionPtr /*or whatever*/
{
// here your code
~MyConnection() { ... }
};
This guarantees that CoInitialize() is called as the very first, and CoUnitialize() as the very last function.
|
|
|
|
|
I have had this symptom before, and my problem was that I had amulti-thread app and I didn't Always marry the CoInit with the CoUninit.
I had two solutions, make sure every thread calls Coinit and CoUninit correctly
(as I had a bug) and use CoInitializeEx(Multithread)!
This my be a different problem to yours, but then again it may not!
Jules.
|
|
|
|
|
Hi
I need to upload binary file (dll) to SQL Server database throught ADO.
I tried to use "ADODB.Stream" object, but i can't open this stream from the file.
hVecoStream->Open(n, adModeUnknown, adOpenStreamUnspecified, _bstr_t(""), _bstr_t(""));
hVecoStream->LoadFromFile(szFileName);
Could you specify correct syntax for this method call
Thanx.
|
|
|
|
|
Have you tried ASP.Upload. Got to aspupload.com
|
|
|
|
|
|
if any body can please help me out, i have to replicate the data of client site to server now the problem is which method should i addopt and which one will be the best in what circumstances, If i use any of the following way.
1.text format
2.Recordset(ADO)
3.XML
or what will be the benifit and disadvantage of any of these method.
Is there any othere method also to transfer the data to remote site???
please answer either on board or on bin_omair@usa.net
Thanx
Efan
|
|
|
|
|
Well, if both the databases are SQL-Servers I would use the Data Transfer or the Replication in SQL Server.
To get a better answer, you'll need to be more specific, in what it is you want...
- Anders
|
|
|
|
|
if any body can please help me out, i have to replicate the data of client site to server now the problem is which method should i addopt and which one will be the best in what circumstances, If i use any of the following way.
1.text format
2.Recordset(ADO)
3.XML
or what will be the benifit and disadvantage of any of these method.
Is there any othere method also to transfer the data to remote site???
please answer either on board or on bin_omair@usa.net
Thanx
Efan
|
|
|
|
|
Does anybody know how to get data stored into VARCHAR data field of Interbase using ADO and Visual C++?
Mukhit
|
|
|
|
|
I'm having major problems using nested outer joins with
SQL Server 6.5 and ODBC.
I'm following the documentation to the letter but I'm getting
the error "The column prefix '' does not match with
a table name of alias used in the query"
I do not get errors when using Oracle.
Does anyone have an example of nested outer joins?
Many thanks.
|
|
|
|
|
I think they had limits on the nesting. What does the Oracle query look like?
Bob Zagars
|
|
|
|
|
I am running a large links database at http://www.scoutinglinks.com so record paging is a must.
My problem is that many of my users are still using Netscape 4.x. These user can view the first page with out problems, if they select a link the next page they receive "the parameter is incorrect" error message. I have confirmed the error through testing, the reports are accurate.
I have rewritten the function numerous times, the last method I found here at The Code Project "http://www.codeproject.com/asp/rspaging.asp" with the same result.
If anyone has ever experienced this and found a solution your suggestions would be appreciated. I have asked these users to upgrade to Netscape v 6, but we all know how that goes. I have also tried finding a Java solution but really don't want to rewrite the whole app.
Again, any help would be appreciated.
Regards
Bert
|
|
|
|
|
Kind all,
I built this MTS object that runs a SP and should be able to returns to the user:
'1) (if existing) the Rs(s) found for the wanted DB table(s);
'2) the adParamOutput, adParamReturnValue ADODB.Parameters
from the SP.
When I run the component the following things happen:
* the adParamOutput and the adParamReturnValue ARE EMPTY
(note that I forced the SP to return in any case a Return value and a value as output paramter).
** when I loop the array that should comntain all the RS(s) contained in a specific DB field, I get
the usual "Subscript out of range".
I poste my code: both the code (DBObj.cls) for the DB object and the code (.frm) I used x testing it.
The name of the DLL project is: OggettoDB.
-----------------START OF THE DB OBJ (DBObj.cls)----------
Option Explicit
Implements ObjectControl
Dim ctxObject As ObjectContext
'******************************************************************************************
'this function should returns:
'1) all the Rs found for the wanted DB table fields: Id(), Datacurr(), TipoRep() and path()
'are the arrays that should contain the found Rs(s) for the 4 choiched DB fields;
'all these are passed byref
'2) the adParamReturnValue parameter: I choiched here that the return value from the
'SP be the return value of this function
'3) the adParamOutput: is the outparam passed byref too.
'4) currdata is the adParamInput
'*******************************************************************************************
Public Function RunAnySP(Id() As Variant, Datacurr() As Variant, TipoRep() As Variant, _
path() As Variant, outparam As Variant, ByVal currdata As Variant) As Variant
'ho scelto che il valore di ritorno della funzione sia il valore di ritorno dalla SP
Dim Cn As ADODB.Connection, Rs As ADODB.Recordset
Dim Cmd As ADODB.Command
Dim Param1 As ADODB.Parameter, Param2 As ADODB.Parameter, Param3 As ADODB.Parameter
On Error GoTo ErrorHandler
Dim cnstring As String
cnstring = "Provider=SQLOLEDB.1;Initial Catalog=Finanza;Data Source=direct-comflcg;"
Cn.Open cnstring
Set Cmd.ActiveConnection = Cn
Cmd.CommandText = "myProc"
Cmd.CommandType = adCmdStoredProc
Set Param1 = Cmd.CreateParameter("paramimput", adDate, adParamInput, currdata)
Cmd.Parameters.Append Param1
Set Param2 = Cmd.CreateParameter("parametroutput", adInteger, adParamOutput)
Cmd.Parameters.Append Param2
Set Param3 = Cmd.CreateParameter("valoreritorno", adInteger, adParamReturnValue)
Cmd.Parameters.Append Param3
Set Rs = Cmd.Execute
'Dim recordsAff As Long
'Cmd.Execute recordsAff
'If recordsAff = 0 Then MsgBox "Nessun record trovato/inserito!"
'here I fill the 4 array (corresponding to the 4 choiched DB fields) with the data found in the DB
Dim contatore As Variant
contatore = 0
While Not Rs.EOF
Id(contatore) = Rs.Fields(0)
Datacurr(contatore) = Rs.Fields(1)
TipoRep(contatore) = Rs.Fields(2)
path(contatore) = Rs.Fields(3)
contatore = contatore + 1
Rs.MoveNext
Wend
Rs.Close
'After having close the Rs I assign its value to the parameter n 1: as I said, this is the outparam
outparam = Cmd.Parameters(1)
'as I already said, the return value of the function is the adParamReturnValue
Set RunAnySP = Param3
Cn.Close
Set Cn = Nothing
Set Rs = Nothing
Set Cmd = Nothing
ctxObject.SetComplete
Exit Function
ErrorHandler:
If Not Cmd Is Nothing Then
Set Cmd = Nothing
End If
If Not Rs Is Nothing Then
Set Rs = Nothing
End If
If Not Cmd Is Nothing Then
Set Cmd = Nothing
End If
ctxObject.SetAbort
End Function
Private Sub ObjectControl_Activate()
Set ctxObject = GetObjectContext()
End Sub
Private Function ObjectControl_CanBePooled() As Boolean
ObjectControl_CanBePooled = False
End Function
Private Sub ObjectControl_Deactivate()
Set ctxObject = Nothing
End Sub
----------------START OF CODE X THE .FRM MODULE-----------
Option Explicit
Option Base 1
Private Sub Form_Load()
Dim OggettoDB As OggettoDB.DBObj
Dim id() As Variant
Dim Data() As Variant
Dim Tipo() As Variant
Dim Path() As Variant
Dim out As Variant
Dim myvar As Variant
Dim parainput As Variant
parainput = "1/16/2001"
Set OggettoDB = CreateObject("OggettoDb.DBObj")
myvar = OggettoDB.RunAnySP(id(), Data(), Tipo(), Path(), out, parainput)
'myvar is the return value
MsgBox myvar 'the value is empty
MsgBox out 'the value is empty too
Dim x As Integer
For x = 0 To UBound(Data) 'when I start this cycle I get out of range error
MsgBox Data(x)
Next x
End Sub
Private Sub ObjectControl_Activate()
Set ctxObject = GetObjectContext()
End Sub
Private Function ObjectControl_CanBePooled() As Boolean
ObjectControl_CanBePooled = False
End Function
Private Sub ObjectControl_Deactivate()
Set ctxObject = Nothing
End Sub
|
|
|
|
|
I am trying to append record to the newly created Database(which is created thro' DAO ) thro' program . But, i am unable to add the first record(thro' ADO).But if I add the first record manually(directly into the DB)the following records are getting appended thro' program perfectly.
How can I append the first record thro' the program .
Y.Yamini Devi
|
|
|
|
|
i to have the same problem as you. so if you find a solution, do let me know. my email i.d. is babu_says@yahoo.com
|
|
|
|
|
Hi
I wonder if MS-SQL use some hashing table when i create
atable in which the key is a string(URL)
if no,do you think that by using hashing function on each string
and stroing the result(from the hashing function)
in the data base will increase searching performance...?
(the result is a numeric value)
thanks
tomer dror
tomerdr@hotmail.com
|
|
|
|