|
This solution is for Oracle, I don't know if and how you can use it in other systems:
SELECT rownum, col1, col2, col3 FROM table;
--
karl
|
|
|
|
|
Hi,
I have created a DLL which access the DAO objects (specially MSAccess
databases). In the code I create the CDaoRecordset with the new operator,
like this:
CDaoRecordset * CDaoClass::Query(CString query)
{
CDaoRecordset * pNewRecord = new CDaoRecordset(&m_pDatabase);
pNewRecord->Open(AFX_DAO_USE_DEFAULT_TYPE, query, 0);
return pNewRecord;
}
CDaoClass::CloseRecordSet(CDaoRecordset * pRecord)
{
pRecord->Close();
delete pRecord;
}
This works just as it should if the classes are in the main application,
but I'm getting an exception when in DLL the CDaoRecordset::Open() method
is executed. The other DAO methods are working fine, so I can list the
tables, change them, create indexes, relationships, etc. But I can't
execute queries that returns data.
When debugging the application I found out that there is an exception in
DAOCORE.CPP line 4855, shown bellow:
void CDaoRecordset::BuildSelectList()
{
ASSERT_VALID(this);
ASSERT(m_nFields > 0); // This line will assert since m_nFields is 0
m_strSQL += _afxSelect2;
CDaoFieldExchange fx(CDaoFieldExchange::AddToSelectList, this);
DoFieldExchange(&fx);
}
Does anyone have any clues about it?
Thanks in advance.
Crercio O. Silva / DBTools
Crercio O. Silva / DBTools Development
http://www.dbtools.com.br
|
|
|
|
|
http://www.theregister.co.uk/content/53/29419.html
Oh what a tnagled web we weave, when what we use is not free!
Use PostgreSQL (www.postgresql.org) instead!
PS. Native Windows port coming soon. In the meantime, you can run it under Cygwin.
|
|
|
|
|
|
Makes you wonder what other MS Licenses may have holes in them. But did anyone figure out exactly what pieces they are barking about? Sounds like Olap/Analysis services but maybe even DTS as well.
|
|
|
|
|
I need to create a table programatically in MS Access with
a field having data type AutoNumber.
I am using VC++ tool and ADO and Catalog Smartpointer for creation of tables.
Send me suggessions how to do it.
With Thanks & Regards
Kamesh
|
|
|
|
|
I have a problem with SQLDMO, in my MFC Application I use DMO to restore/backup a SQL DB; when I specify a path that contains blank spaces DMO fail to perform the operation because the resulting path is a merge from my path and the default one.
i.e. mypath = "D:\My Folder" resulting path =" C:\ProgramFiles\Microsoft SQL Server\.......\My Folder"
Can anyone suggest me any possible solutions ?
Thank you all!!!!
|
|
|
|
|
Please post you code example. Also if you are using the .RelocateFiles proterty of the SQLRestore method are you putting [] around the path data as required. Keep in mind this is a multipart string and requires the []'s.
Is this by chance joecre from the CodeGuru boards?
|
|
|
|
|
Yes i am......thank you again
|
|
|
|
|
I have this very weird problem - when I invoke a stored procedure from ASP, it complained that one of the input parameter was "declared" as OUTPUT but the ASP call indicated otherwise. Error message as follows:
"Microsoft OLE DB Provider for SQL Server error '80040e14'
Formal parameter '@employee_division_code' was defined as OUTPUT but the actual parameter not declared OUTPUT."
I have checked, and double checked. The parameter was defined as INPUT parameter in SQL server stored procedure. I have included both signature of stored procedure, and the ASP/ADO API call below - hope one of you wiz can help me spot a problem that I failed to spot. Please look for <PROBLEM> tag - that's how I highlight the problem.
(1) Here's the stored procedure:
CREATE PROC dbo.sproc_AddUser
@login char(15) =NULL,
@password char(15) =NULL,
@first_name char(50) =NULL,
@middle_name char(50) =NULL,
@last_name char(50) =NULL,
@email1 char(50) =NULL,
@email2 char(50) =NULL,
@tel_home char(30) =NULL,
@tel_office char(30) =NULL,
@tel_fax char(30) =NULL,
@tel_cell char(30) =NULL,
@tel_pager char(30) =NULL,
@title char(100) =NULL,
@association char(50) =NULL,
@address_unit_num char(15) =NULL,
@address_bldg_name char(50) =NULL,
@address_street_num char(15) =NULL,
@address_street char(100) =NULL,
@address_city char(100) =NULL,
@address_province char(100) =NULL,
@address_country char(100) =NULL,
@address_zipcode char(100) =NULL,
@employee_division_code char(500)='EMPLOYEE, REGUSER',
@customer_division_code char(500)='CUST, REGUSER',
@seniority_level int=0,
@cust_service_level int=0,
@bAdminStatus int=0, ********** <PROBLEM> **********
@bEmployStatus int=0,
@bClientStatus int=0,
@error_status int OUTPUT
WITH RECOMPILE
AS
...
...
...
(2) Here's fragment of my ASP script:
Set oCmd = Server.CreateObject("ADODB.Command")
With oCmd
.ActiveConnection = oConn
.CommandText = "sproc_AddUser"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("@login", adChar, adParamInput, 15, Request.Form("txtLogin") )
.Parameters.Append .CreateParameter("@password", adChar, adParamInput, 15, Request.Form("txtPasswd") )
.Parameters.Append .CreateParameter("@first_name", adChar, adParamInput, 50, Request.Form("first_name") )
.Parameters.Append .CreateParameter("@middle_name", adChar, adParamInput, 50, Request.Form("middle_name") )
.Parameters.Append .CreateParameter("@last_name", adChar, adParamInput, 50, Request.Form("last_name") )
.Parameters.Append .CreateParameter("@email1", adChar, adParamInput, 50, Request.Form("email1") )
.Parameters.Append .CreateParameter("@email2", adChar, adParamInput, 50, Request.Form("email2") )
.Parameters.Append .CreateParameter("@tel_home", adChar, adParamInput, 30, Request.Form("tel_home") )
.Parameters.Append .CreateParameter("@tel_office", adChar, adParamInput, 30, Request.Form("tel_office") )
.Parameters.Append .CreateParameter("@tel_fax", adChar, adParamInput, 30, Request.Form("tel_fax") )
.Parameters.Append .CreateParameter("@tel_cell", adChar, adParamInput, 30, Request.Form("tel_cell") )
.Parameters.Append .CreateParameter("@tel_pager", adChar, adParamInput, 30, Request.Form("tel_pager") )
.Parameters.Append .CreateParameter("@title", adChar, adParamInput, 100, Request.Form("title") )
.Parameters.Append .CreateParameter("@association", adChar, adParamInput, 50, Request.Form("association") )
.Parameters.Append .CreateParameter("@address_unit_num", adChar, adParamInput, 15, Request.Form("address_unit_num") )
.Parameters.Append .CreateParameter("@address_bldg_name", adChar, adParamInput, 50, Request.Form("address_bldg_name") )
.Parameters.Append .CreateParameter("@address_street_num", adChar, adParamInput, 15, Request.Form("address_street_num") )
.Parameters.Append .CreateParameter("@address_street", adChar, adParamInput, 100, Request.Form("address_street") )
.Parameters.Append .CreateParameter("@address_city", adChar, adParamInput, 100, Request.Form("address_city") )
.Parameters.Append .CreateParameter("@address_province", adChar, adParamInput, 100, Request.Form("address_province") )
.Parameters.Append .CreateParameter("@address_country", adChar, adParamInput, 100, Request.Form("address_country") )
.Parameters.Append .CreateParameter("@address_zipcode", adChar, adParamInput, 100, Request.Form("address_zipcode") )
.Parameters.Append .CreateParameter("@bAdminStatus", adInteger, adParamInput, 4, bAdminStatus) ********** <PROBLEM> **********
.Parameters.Append .CreateParameter("@bEmployStatus", adInteger, adParamInput, 4, bEmployStatus)
.Parameters.Append .CreateParameter("@bClientStatus", adInteger, adParamInput, 4, bClientStatus)
.Parameters.Append .CreateParameter("@cust_service_level", adInteger, adParamInput, 5, CInt(Request.Form("cust_service_level")) )
.Parameters.Append .CreateParameter("@error_status", adInteger, adParamOutput, 4, 0) 'OUTPUT: error status.
'Execute the stored procedure:
.Execute()
End With
Thanks a bunch.
norm
|
|
|
|
|
i have experienced this before.
despite the fact that parameters are named, you still need to create the right number and the right type of paramers in the ADODB.Command object. basically, what is happening is that the parameters you are passing from vb are not lining up with the proc paramaters the way you think they are.
declare your vb parameter list identically to the sp param list, including the ones you don't realy need (don't set a value for them in vb if you want to use the SPs default values).
it will work then.
#include <beer.h>
|
|
|
|
|
thanks. yes, the orders of parameters in asp script is NOT the same as that as defined in stored procedure - I took time to make sure the parameter NAME ana TYPE matches however. Didnt expect the order would matter too.
Just hope that this is the root of the problem. Will work on it later today and will let you know what happen.
norm
|
|
|
|
|
I need to output from DB2 to MS Excel in C# using INSERT TO statement, how can I do that please?
Many Thanks,
Jassim Rahma
Jassim Rahma
|
|
|
|
|
Hello, the CPians around the world.;)
One time, I try to export some sql statement generated by SQL Server to MySQL on RedHat Linux 7.2
However, I got a bunch of error messages from MySQL Server.
I found that some syntax of SQL statement generated by SQL Server would
be not supported by MySQL.
First time, I try to delete [dbo] from SQL file, but I notice that some
value type will not be supported by MySQL.
Does anyone know any tools to overcome this kind of HELL?
Thank you in advance.
-Masaaki Onishi (eCoolSoft)-
ASP.NET Web and Windows
Application Development by C# and MFC.
eCoolWebPanelBar(BETA) is availabe now.
http://www.ecoolsoft.com
|
|
|
|
|
Everyone has their own SQL syntax...
You might want to try PostgreSQL[.org] instead. You can use it as a back-end to MS Access, so it should be more compaitble than MySQL.
If you're using SQL server, PostgreSQL is a better match for you anyway.
(And no, I know of no tools)
|
|
|
|
|
No thanks, postgresql spammer. Get a real database.
|
|
|
|
|
Indeed I am a PostgreSQL 'spammer'. I do this because when people think open source database they think MySQL is the flag ship. Indeed it is not. PostgreSQL can compete with Oracle on Features while having respectible speed. It's just the most popular because it's always been an easy install under most platforms.
Am I to assume going to assume you prefer the worm-ridden MS SQL server? I think it might be good to mention now that I also think Oracle is good as well, but since this guy was using a MySQL database, it'd be a good assumption he want to stay cheap and free.
What do you suggest is a 'real' database?
|
|
|
|
|
Scorp1us wrote:
What do you suggest is a 'real' database?
Indexed cards and a filing cabinet?
Sorry...
David Wulff http://www.davidwulff.co.uk
|
|
|
|
|
Hi,
I wanna get the number of records of a table from an Access database by CDatabase & CRecordset classes.
What is the appropriate function?
Thank you in advance.
|
|
|
|
|
Hi,
You can pass this query :
Select Count(*) from tableName
|
|
|
|
|
i am a freshman in asp.net , but i have background in asp using visual interdev 6.
i want to display a set of records in a database using datagrid in a web.
can anybody help me how?
mr. boljok
|
|
|
|
|
Dim connection As OLEDBConnection = New OleDBConnection(strConnection)
Dim command As OledbCommand = New OleDbCommand("select * from table",connection)
connection.Open()
dtGrid.DataSource = command.ExecuteReader()
dtGrid.Bind()
Learning and Working
|
|
|
|
|
Hi everybody!
I'm new to ADO and I want to create an MFC Application using ADO for my database manipulation. So I started with an easy example.
In the example, I need to write:
#import "c:\Program Files\Common Files\System\ado\mmado15.dll" no_namespace
rename("EOF", "EndOfFile")
But that doesn't work! I have a error tolding me that WS.NET cannot find msado15.dll.
So I looked at my path and make a research for it and I realize that msado15.dll do not exist.
So where can I find it?
thanks for helping.
Everything's beautiful if you look at it long enough...
|
|
|
|
|
Your example has msado15.dll mispelled. Try this:
#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
no_namespace rename("EOF", "EndOfFile")
Darrell Long
|
|
|
|
|
msado15.dll is part of the MDAC[^] run-time.
|
|
|
|
|