Dear all:
I have using DBUSEAREA() for query data from SQL server 2008 and work well.
Today I encounter a big problem while query data from fields which is uniqueidentifier data type.
The DOS error message display while I execute application, which as attachment.
Following are partial source code:
227:m_sqlLogin:='select t_Pk from RACSystem..RACPatientInfo where t_PatientNo='+"'"+m_s1+"'"+';'
228:DBUSEAREA(.T.,,m_SQLLogin, "TEMPDBF1" )
The field 『t_Pk』is uniqueidentifier data type.
Please Help!
Best Regards
chen min
Problem about select uniqueidentifer field from SQL by using
Moderator: Rathinagiri
-
huangchenmin
- Posts: 157
- Joined: Mon Jun 07, 2010 2:24 am
Problem about select uniqueidentifer field from SQL by using
- Attachments
-
- SQLerror.JPG (137.33 KiB) Viewed 3584 times
Re: Problem about select uniqueidentifer field from SQL by u
Maybe these two dots are redundant? Maybe only one is required:huangchenmin wrote:Dear all:
I have using DBUSEAREA() for query data from SQL server 2008 and work well.
Today I encounter a big problem while query data from fields which is uniqueidentifier data type.
The DOS error message display while I execute application, which as attachment.
Following are partial source code:
227:m_sqlLogin:='select t_Pk from RACSystem..RACPatientInfo where t_PatientNo='+"'"+m_s1+"'"+';'
228:DBUSEAREA(.T.,,m_SQLLogin, "TEMPDBF1" )
The field 『t_Pk』is uniqueidentifier data type.
Please Help!
Best Regards
chen min
Code: Select all
227:m_sqlLogin:='select t_Pk from RACSystem.RACPatientInfo where t_PatientNo='+"'"+m_s1+"'"+';'
-
huangchenmin
- Posts: 157
- Joined: Mon Jun 07, 2010 2:24 am
Re: Problem about select uniqueidentifer field from SQL by u
Dear mol:mol wrote:huangchenmin wrote:Dear all:
Maybe these two dots are redundant? Maybe only one is required:Code: Select all
227:m_sqlLogin:='select t_Pk from RACSystem.RACPatientInfo where t_PatientNo='+"'"+m_s1+"'"+';'
Thanks for replying to me.
I have been try before about 1 dot. It have to be 2 dot.
DBF take SQL uniqueidentifier as hexadecimal type and fail to deal with it.
I also tried to add SQL function 'CAST' or 'CONVERT' to m_SQLLOGIN. It also fails.
Best Regards
chen min
-
huangchenmin
- Posts: 157
- Joined: Mon Jun 07, 2010 2:24 am
Re: Problem about select uniqueidentifer field from SQL by u
Dear mol:mol wrote:huangchenmin wrote:Dear all:
Maybe these two dots are redundant? Maybe only one is required:Code: Select all
227:m_sqlLogin:='select t_Pk from RACSystem.RACPatientInfo where t_PatientNo='+"'"+m_s1+"'"+';'
My problem had been solved!
You wouldn't believe how simple it is.
m_sqlLogin:='select CAST(t_Pk AS varchar(36)) AS DDAA from RACSystem..RACPatientInfo where t_PatientNo='+"'"+m_s1+"'"+';'
CAST(t_Pk AS varchar(36)) convert uniqueidentifier to varchar with length of 36 byte.
『AS』followed function CAST must have. It refer to a new title for query result that DBF could recognize.
Best Regards
chen min
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Problem about select uniqueidentifer field from SQL by u
Fantastic. Thanks a lot for sharing. 
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.