|
Does anyone know how to pass parameters into an sql command?
Either prompting or just straight in?
Sample code or KB would be very useful.
Thankyou verymuch
Richard.
|
|
|
|
|
what I know is you can difine a string variable as shown below
dim SqlSt as string
dim Db as ADODB.Connection
db= new ADODB.connection
Sqlst ="INSERT INTO TABLE1, Name VARCHAR(10),Surname, VARCHAR(1)"
db.execute slqst
|
|
|
|
|
Does anyone know how to pass parameters into an sql command?
Either prompting or just straight in?
Sample code or KB would be very useful.
Thankyou verymuch
Richard.
|
|
|
|
|
Hello,
I can't find an elegant solution for the following using ASP2.0 with MS SQL 7.0 SP2:
I would like to select the last 10 rows of a query without using RecordSet.MovePrevious nor using FETCH
anyone has an idea ?
Thanks,
Steven
|
|
|
|
|
if you have a key that can be used for a sort order (ORDER BY) then you can say something like:
SELECT TOP 10 whatever FROM whatever ORDER BY key DESC
it will give the first 10 items entered into the table, ie, the bottom 10 of the recordset
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Thanks Lauren,
I figured that out myself too
The problem is that I want the last ten rows displayed in ascending order without having to use RecordSet.Previous.
The recordset should contain the last ten rows (I know the value of last item in the table regarding to the query) in ascending order so I can display them using
while vRS.EOF = False Then
<display vrs.fields("value").value="">
vRs.MoveNext
...and I don't want to swim through a big recordset using FETCH...
any ideas ?
Thanks,
Steven
|
|
|
|
|
are you processing the results on the server before display? if so you could do the previous suggestion and simply run a flip algorithm on the results set in memory
reasons like this stop me using recordset objects
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hello,
Maybe this will help you.
SELECT a.member_no
FROM adult AS a
WHERE a.member_no IN
(SELECT TOP 10 b.member_no
FROM adult AS b
ORDER BY b.member_no desc)
ORDER BY a.member_no
It's not elegant.
It works!!
Edwin.
|
|
|
|
|
Hi there,
I was wondering if there is anyway to set the size of SQL Server log files that you can see under the "Management" folder.
thanks
|
|
|
|
|
I've created an MFC application using DAO to access a DBASE database. It works great on my system, but when trying to run the MFC application on a clean win98 system, i get a
"Unable to initialize DAO/Jet db engine." error. Does anyone know how i can fix this?!?! I've tried installing the newest version of MDAC...but this did'nt help.
|
|
|
|
|
I have installed MDAC 2.5 on a development machine and am trying to use the OLE DB consumer templates to access an Oracle database. Oddly it seems that I also have to have installed the Oracle client in order to get this to work. Does anyone have an example of how open a datasource using the microsoft OLE DB provider. I'm using the following, but it will only work if the Oracle client is installed also
HRESULT hr;
CDataSource db;
CDBPropSet dbinit(DBPROPSET_DBINIT);
// dbinit.AddProperty(DBPROP_AUTH_PASSWORD, OLESTR("PASSWORD"));
// dbinit.AddProperty(DBPROP_AUTH_USERID, OLESTR("USERID"));
dbinit.AddProperty(DBPROP_INIT_DATASOURCE, OLESTR("DB_NAME"));
// dbinit.AddProperty(DBPROP_INIT_LCID, (long)1033);
dbinit.AddProperty(DBPROP_INIT_PROMPT, (short)DBPROMPT_COMPLETE);
// dbinit.AddProperty(DBPROP_INIT_PROVIDERSTRING, OLESTR(""));
// hr = db.Open(_T("OraOLEDB.Oracle.1"), &dbinit);
hr = db.Open(_T("MSDAORA.1"), &dbinit);
Any comments are welcome. Thanks.
Chris
|
|
|
|
|
Sorry - MS OLEDB provider for Oracle requires Oracle client. From MDAC 2.5 documentation:
"The Microsoft OLE DB Provider for Oracle requires a system running: Oracle client software (appropriately installed and configured) version 7.3.3.4.0 or later, or for Oracle8, version 8.0.4.1.1c"
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thanks, Tomasz. I happened to miss that little gem. And it certainly helps answer a lot of questions.
Chris
|
|
|
|
|
Help me please!!!
I want convert data from access table to Excel file in code.
How can I do this?
Thank's to everybody!!!
|
|
|
|
|
I get the error "Connection is busy with results for another hstmt" when I call the CRecordset::Open on an SQLServer database. The code has been working for several years on WATSQL (now Sybase SQLAnywhere) until I switched the database recently to run on SQLServer. Does anyone have an idea what is going on, or what options I may need to set to get rid of this. For instance, in the code below, line (1.) works without problem, while line (2.) fails giving the error above. Both statements were failing on ::SQLExecute(m_hstmt) inside MFC;
1. if (!m_pAssetSet->Open(CRecordset::snapshot))
DisplayError();
2. if (!m_pAssetypeSet->Open(CRecordset::snapshot))
DisplayError();
Also, when I switch the code to call Open with default arguments, both Open statements work, but then my Add/Edit/Update on m_pAssetSet fails right in the bowels of MFC with SQLSetPos on line (1.) as follows:
::SQLSetPos(m_hstmt, 1, wPosOption, SQL_LOCK_NO_CHANGE);
The second error message is something to the effect that an option is invalid. Does anyone have any idea what is causing this? Why should I be getting this even when I call CRecordset::Open with default arguments.
Any suggestions?
|
|
|
|
|
Hi,
I execute the following querry in querry analyser and it takes more than 2 minutes to complete the execution. this is the querry
select * from tablename
table has 155000 records and it is indexed.
is it a common one or does the sql server requires any tuning adjustments.
pls help
srinivasan
|
|
|
|
|
create an index on the table.
Visual Basic programmer.
--------------------------------------------------
Share your thoughts..
|
|
|
|
|
Depending on your settings in the analyzer, queries can tak a lot longer than when running from a normal client...
Maybe the server needs more memory/cpu
maybe the disks are too slow
maybe the server have way too much other work to do
It's a hard question to answar without knowing a lot about the system...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Could somebody explain why the following segment of the code is throwing exception in the last line. The error is -2146825069 (0x800A0C93) Remote ADO Error: The operation requested is not allowed in this context.
//*******************************************
_ConnectionPtr pConnection = NULL ;
pConnection.CreateInstance(__uuidof(Connection));
_RecordPtr pRec = NULL ;
pRec.CreateInstance(__uuidof(Record));
_bstr_t strConn2("Provider=MSDASQL;Driver={Microsoft Text Driver (*.txt; *.csv)}; DBQ=C:\\Temp" ) ;
pConnection->Open(strConn2,"","",NULL);
pRec->Open("1.txt", pConnection.GetInterfacePtr(), adModeReadWrite, adFailIfNotExists, adOpenRecordUnspecified, "", "" ) ;
//*******************************************
What is wrong??? Why I can't open simple text file through Record object???
Bob ( Expert_30@yahoo.com)
|
|
|
|
|
Hi Bob,
i have done the following and it works:
_ConnectionPtr pConnection = NULL ;
pConnection.CreateInstance(__uuidof(Connection));
_RecordsetPtr pRec = NULL ;
pRec.CreateInstance(__uuidof(Recordset));
_bstr_t strConn2("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\Northwind.mdb") ;
pConnection->Open(strConn2,"","",NULL);
pRec->Open("SELECT * FROM [Text;Database=c:\\Temp;HDR=YES;FMT=Delimited].[1.txt]", pConnection.GetInterfacePtr(),
adOpenStatic,
adLockReadOnly,
adCmdText);
int nCount = pRec->GetRecordCount();
The data:
"Praefix";"Trennung"
"acco";5
"asso";5
"comm";5
"comp";5
"conc";5
"conf";5
|
|
|
|
|
How can i pass parameters along with SQL query( consider a buffer of binary
data also can be a parameter) in ADO's via VC++.
Please send me a sample.
My mail id is kgrajashekar@usa.net
Thanks in advance.
|
|
|
|
|
Hi there,
I have an online job that is being executed on regular schedules. On some occassions, while going through various stored procedures, a DBCC process with a spid of 6 is created. Around the same, I see a message inidicating that a deadlock has been resulted between my currently running process and this DBCC process.
This running DBCC process causes the CPU to be utilized massively and being a system process, can not be killed, unless I re-start the SQL Server.
I was wondering how one could find out the reason this DBCC process starts off to begin with? HOw do I know which DBCC command it is?
thanks
|
|
|
|
|
Hi Amigos!
Converting DB_NUMERIC to anything useful looks like a nightmare. I particularly need to convert it to a string ... can anybody help me???
Thankyou, and happy coding
NB
|
|
|
|
|
Create the client side IAccessor with a binding of DBTYPE_STR and it will do the job for you
|
|
|
|
|
Has anyone used this particular feature with Oracle databases and to success? I'm researching using this feature within an application in order to remove the redundant userid/password prompt that is presently used. The intent is to force user's to logon to the domain first before they can run the application and having done that, to *NOT* be prompted for a userid/password combination by the application. Just wondering about any tips, hints, or war stories that someone else may have.
Thanks.
Chris Meech
|
|
|
|