|
I'm developing a multi-threaded application that communicates with SQL Server via ADO. The application is written in MFC and is being tested on WindowsXP SP2. The problem I'm having is that the following function call will hang the application intermittently and I'm not sure why: Recordset15::Open (part of the ADO API). More specifically, it seems to happen deep within the raw_Open call. Although there are multiple threads running, I've made it so that only the one thread is actually communicating with the ADO database. And, besides, I was under the assumption that the ADO was a thread-safe API. Also, I'm not sharing connections across different threads.
Any ideas?
Thanks,
Karim Shehadeh
http://www.iwonderdesigns.com
|
|
|
|
|
I need to retrieve the last inserted row for unique set of columns
Got a table with
AutoIncrement , Position , status , dateTime
where position is a nr form 1 to 20 and status a nr from 1 to 50
The table get updated continuously and I need to now the last status for every position
|
|
|
|
|
select * from ctm group by AutoIncrement having Position = max(Position) and Status = Max(Status)
should do it.
|
|
|
|
|
select * from mytable where myColumn = @@IDENTITY
see here[^] for more details
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Imagine two table
One Table (ForeignCurrency)
FC_ID FC_TYPE
1 USD
2 EUR
3 YTL
Other table (Rates)
FCV_ID FCV_RateIN FCV_RateOUT FCV_DATE
1 1 1 10/13/2005
2 1.345 1.346 10/13/2005
3 1.651 1.654 10/13/2005
I need to join two table in a one query. I do this so
Select FC.FC_TYPE,ISNULL(FCV_RateIN,1) FCV_RateIN,ISNULL(FCV_RateOut,1) FCV_RateOut from ForeignCurrency FC LEFT OUTER JOIN Rates R ON FC.FC_ID=R.FCV_ID WHERE FCV_Date='10/13/2005'
This give me result as i want. But when i need 10/14/2005 rates it give me empty result set , but i expect
FCV_TYPE FCV_RateIn FCV_RateOUT
YTL 1 1
USD 1 1
EUR 1 1
How can i re-write code ?
|
|
|
|
|
If you want the resultset independent of the FCV_DATE column just remove it from the where clause.
Since there is no column with FCV_Date='10/14/2005' you get an empty resultset.
|
|
|
|
|
I use ODBC programming in order to connect VC++ with database. For that i First create system DSN, Use CDatabase class SQLConnect(...) function in order to connect to the DSN, Then use SQLExecDirect in order to run the querry. But i am facing problem with CSV files.
I Created a system DSN of Microsoft Text Driver and then connected it worked. As you know in CSV files it automatically takes first rows as the field name. Therefore if I run the query "SELECT * FROM TableName.csv", IT works. But if I write a querry "SELECT Col1, Col2,....Coln FROM TableName.csv" It does'nt work cuz it is unable to recognize and individual column. Now I need to run a querry in order to check for an existing data "SELECT * FROM TableName.csv WHERE Col1 = 'MyName'" even this query generates an error.
So can anyone help me how to reslove this selection problem?
|
|
|
|
|
safety setting on this computer prohibit accessing a data source on another domain.
Have good day and time
|
|
|
|
|
Hello there i have a connectionstring like below:
var connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=false;Data Source=E:\\mohebi\\b1384.6.26\\adabiat1\\data base\\db_demo.mdb";
and when i wana open it on IIS on my local computer, i have this ADO Security Warning :
This website is using your identity to access a data source.If you trust this website ,
click OK to continue ,otherwise click Cancel.
I found the way to deny this warning and that is adding my website to TRUSTED SITES in IE.
BUT when i use this source on MY SERVER ,MY SERVER is WINDOWS SERVER 2003, it is another warning like below:
safety setting on this computer prohibit accessing a data source on another domain.
I can solve this problem with adding it to TRUSTED SITES , but i have many clients , AND OF COURSE I CANT DO THIS FOR ALL MY CLIENTS!!!
how can i solve this problem ??
Have good day and time
|
|
|
|
|
delnaz wrote: safety setting on this computer prohibit accessing a data source on another domain.
As memory serves that’s because you’re running the code client side. You will need to mod it to run server side.
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Okay so I am a complete noob to mysql.
I am trying to run the following statements in mysql query browser
DROP TABLE IF EXISTS `bedbugs`.`airports`;
CREATE TABLE `bedbugs`.`airports` (
`city` char(20) default NULL,
`country` char(20) default NULL,
`name` char(20) NOT NULL default '',
PRIMARY KEY (`name`)
);
basically two different queries through one query window.
I get the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';
CREATE TABLE `bedbugs`.`airports` (
`city` char(20) default NULL,
`cou' at line 1
Can someone explain what is going on. If I comment out either query - the other one runs fine (basically I can run one at a time).
Is this some sort of limitation of the query browser?
thanks in advance
|
|
|
|
|
-- =============================================
-- Create table basic template
-- =============================================
IF EXISTS(SELECT name <br />
FROM sysobjects <br />
WHERE name = N'<table_name, sysname, test_table>' <br />
AND type = 'U')<br />
DROP TABLE <table_name, sysname, test_table><br />
GO<br />
<br />
CREATE TABLE <table_name, sysname, test_table> (<br />
<column_1, sysname, c1> <datatype_for_column_1, , int> NULL, <br />
<column_2, sysname, c2> <datatype_for_column_2, , int> NOT NULL)<br />
GO
I beleive you cannot drop or create two table in 1 statement.
Try the template above.
|
|
|
|
|
Hello guys,
Can anybody give me a link of a website , where is well explained how to
edit , delete and add records in a *.mdb dadatase file.
Or any good tutorial on how to use CDaoDatabase class
I have a MFC Dialog Based Application
And I am using Visual Studio.Net 2003
Thanks in advance
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
-- modified at 12:24 Monday 24th October, 2005
|
|
|
|
|
mdb database files are also known as Access databases. You could try this link http://www.codeproject.com/cs/database/csharpaccessdb.asp[^] or any other article present in the C# Database Section[^].
Basicly you can handle that type of database trough OleDb or Odbc in the same ADO.NET manner but using diferent implementations...
I hope you understand...because is a rough world out there...
|
|
|
|
|
thanks , but I need to implement it in C++
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
hello..
I'm using MYSQL and have a table with two fields :tag_in and time_in, where time_in is a timestamp field..
Some rows have the same value for tag_in.. I'd like to neaten up the database in 2 ways:
1. Delete rows with duplicate tag_in but removing the one with the oldest timestamp value
2. Delete rows with duplicate tag_in but removing the one with the latest timestamp value
how can i go about this please ?
|
|
|
|
|
Get the minimum - select min(tag_in)
Get the maximum - select max(tag_in)
|
|
|
|
|
thanks for the reply.. but that just gives me one value of tag_in which is the smallest out of the whole table.. or am i overlooking something ??
|
|
|
|
|
if (
select count(*) as EmtCnt from dtemdt where emdtactive = 0<br />
and datediff('d',dtetime,getdate()) > 1 )
begin
--delete from dtemdt where emdtactive = 0 and datediff('hh',dtetime,getdate()) > 24
end
Please tell me the error, I can't figure it out.
|
|
|
|
|
What is the error message - or what is the result set you are getting compared with the result set you expected to get?
Also, you may like to look into IF EXISTS (SELECT * FROM ....) it is faster than using COUNT(*) especially if there is a large amount of data.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Error Message after running the SQL from SQL analyzer
Server: Msg 1023, Level 15, State 1, Line 2
Invalid parameter 1 specified for datediff.
|
|
|
|
|
Don't put the d inside apostrophes
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
I want to develop a "multi datasource type" application (an aplication that should be able to querry more than one sql sever type - dbase, mysql, mssql, acces, excel)
Implementing my own communication drivers for dbase, acces, excel, and so on..., would be a waste of time in my opinion.
So my first question comes about an speed issue : whitch is faster, ado.net's odbc or ado.net's oledb? Meaning that the datasources I am facing are not at all small, having at least 30k rows (in the most favorable cases).
And the second question is about programatically driver detection : whether I use oledb or odbc, how can I find out progamatically if on a certain system the drivers neaded for a datasource type are present?
Thanx.
I hope I understand as quick as possible...because is a rough world out there...
|
|
|
|
|
Hi,
don't use ado.net odbc or ado.net oledb. U should use a managed provider for very database.
.NET 2.0 provides a buid-in ProviderFactory.
<br />
DbProviderFactory prov = DbProviderFactories.GetFactor("System.Data.SqlClient");<br />
DbConnection conn = provider.CreateConnection();<br />
conn.ConnectionString = CONNECTIONSTRING;<br />
conn.Open();<br />
If you want to use another database you should replace "System.Data.SqlClient".
'A programmer ist just a tool which converts caffeine into code'
|
|
|
|
|
Thank you for your advice, but my target is not .net v2.0.
I intend to build the application in .net v1.1.
The truth is that now I plan to build my own db factory, but I still don't know the answers to my initial questions...
I hope I understand...because is a rough world out there...
|
|
|
|