Home » Developer & Programmer » Forms » ODBC connection in Forms 4.5 (D2K 4.5, WindowsXP)
ODBC connection in Forms 4.5 [message #357439] Wed, 05 November 2008 05:55 Go to next message
kelp
Messages: 10
Registered: October 2008
Junior Member
Hi,

I want to connect my Developer 2000 forms 4.5 to Sql Server 2000 database.

How can i do that ?

Waiting for quick reply.

Thanks in advance.
Re: ODBC connection in Forms 4.5 [message #357560 is a reply to message #357439] Wed, 05 November 2008 19:01 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Look at
ODBC
http://www.orafaq.com/forum/t/88308/67467/
look at bottom of http://www.orafaq.com/forum/t/91999/67467/
Also http://www.orafaq.com/forum/t/93840/67467/
By Maaher
http://www.orafaq.com/forum/m/286342/72104/?srch=heterogeneous#msg_286342

connect Forms 6i with MS Access
http://www.orafaq.com/forum/m/172737/67467/?srch=odbc+tnsnames#msg_172737

David
Re: ODBC connection in Forms 4.5 [message #357853 is a reply to message #357439] Thu, 06 November 2008 23:06 Go to previous messageGo to next message
kelp
Messages: 10
Registered: October 2008
Junior Member
Hi,

Thanks for reply.

I have tried by following the links and the instruction on it.

According to that link i have to connect first oracle database and then i can create a database link. And then i can connect to Sql Server Table.

But i want to connect Sql Server directly from Developer 2000, Forms 4.5 on WinXP OS.

How can i do that ?

Please give me some guideline to solve it.

Waiting for quick reply.

Thanks.

-Kelp

Re: ODBC connection in Forms 4.5 [message #358168 is a reply to message #357853] Sun, 09 November 2008 23:24 Go to previous messageGo to next message
kelp
Messages: 10
Registered: October 2008
Junior Member
Hi,

I have solved this by installing OCA.

Now, i can connect to Sql Server from Forms4.5, but data coming from Sql Server are not exactly as in Sql Server. e. g. Data of type Init or Float can not displaying in Forms.

It show like this :

Data in Sql Server- "4.5546" -> showing in Forms4.5- "-:.1:1:1:1:1"

How can i solve it ?

I am in hurry to solve it.

Please give some quick reply.

Thanks.
Re: ODBC connection in Forms 4.5 [message #358192 is a reply to message #358168] Mon, 10 November 2008 00:58 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Only use the data types that Forms knows about. Use a 'view' (or whatever SQL Server uses) in which you 'convert' the 'init' and 'float' stuff to numbers.

David
Re: ODBC connection in Forms 4.5 [message #358247 is a reply to message #358192] Mon, 10 November 2008 05:34 Go to previous messageGo to next message
kelp
Messages: 10
Registered: October 2008
Junior Member
Thank you very mush for your hint.
Re: ODBC connection in Forms 4.5 [message #358700 is a reply to message #357439] Wed, 12 November 2008 03:56 Go to previous messageGo to next message
kelp
Messages: 10
Registered: October 2008
Junior Member
Hellow Sir,

Now i can connect to Sql Server through Forms4.5.

I created a View in Sql Server and data are correctly comes in forms.

But there is a problem.

If i retrieve data from Sql Server through a single SELECT statement in forms, it comes perfectly.
But when i retrieve data in forms through CURSOR, the last character of any kind of value in any field truncated.

e. g.

Field Data in Sql Server Data in Forms through CURSOR

CodeNo 00019 0001
Sampleno 01208 0120

Further i have set length of the field at forms more then the length in Sql Server Table.

What is the reason of truncation of data ?

Waiting for reply.

Thanking again in advance.
Re: ODBC connection in Forms 4.5 [message #358923 is a reply to message #358700] Thu, 13 November 2008 00:13 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Your 'view' is wrong. Make its fields wider.

David
Re: ODBC connection in Forms 4.5 [message #358932 is a reply to message #358923] Thu, 13 November 2008 00:48 Go to previous messageGo to next message
kelp
Messages: 10
Registered: October 2008
Junior Member
Dear Sir,

I have already take that caution when creating the view. i. e. I have already wider all the field 2 times then original in the table.

I am again mentioning that,

If i retrieve data from Sql Server through a single SELECT statement in forms, it comes perfectly.
But when i retrieve data in forms through CURSOR, the last character of any kind of value in any field truncated.

I have check by adding some extra Character at the end of data value in every field when creating a View in Sql Server, but the result is the same.

Waiting for quick reply.

Thanking you.



Re: ODBC connection in Forms 4.5 [message #358940 is a reply to message #358932] Thu, 13 November 2008 00:53 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Post your 'cursor' code.

David
Re: ODBC connection in Forms 4.5 [message #358942 is a reply to message #358940] Thu, 13 November 2008 00:54 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
I think that there is a 2-byte length at the beginning of each field. Use something like substr(field,3) to get the data.

David
Re: ODBC connection in Forms 4.5 [message #358958 is a reply to message #358940] Thu, 13 November 2008 01:14 Go to previous messageGo to next message
kelp
Messages: 10
Registered: October 2008
Junior Member
Dear Sir,

Cursor Code as bellow :

cursor mdata is SELECT EntryNo entrno, shiftdate shfdate, Shift shf,
DocNo Dno, RouteCode Rtcode, DBC milk_type, SocietyCode soccode, CowBuff CB, SampleNo smpno,
TotalCan totcan, Noofcan can, Weight wg, fat Gfat,
clr Gclr, snf Gsnf, WeightAuto wgA, FatAuto fatA,
CLRAuto clrA, NoOfCanSour noofcanS, WeightSour wgS,
FatSour fatS, SNFSour snfS, NoOfCanCurd noofcanC,
WeightCurd wgC, FatCurd fatC, SNFCurd snfC,
NoOfCanDestroy noofcanD, WeightDestroy wgD,
DestroyReason destroyR, CanNoSour cannoS, CanNoCurd cannoC,
CanNoDestroy cannoD, IpAddr ip, HostName hostN,
UserId uid, EntryDate entrdate, EditUserId edituid,
EditDate editD, SlipPrinted slipP
FROM Milk_Collection
WHERE CowBuff IN ('C', 'B') and
shiftdate = '2008/10/01' and
dbc = 'SOUR';

Waiting for reply.

Thanks for quick Reply.
Re: ODBC connection in Forms 4.5 [message #359132 is a reply to message #358958] Thu, 13 November 2008 18:49 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Is 'Milk_Collection' a table or a view?

David
Re: ODBC connection in Forms 4.5 [message #359166 is a reply to message #358958] Fri, 14 November 2008 00:05 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It is not directly related to your problem, but such a condition promises problems in the future:
where shiftdate = '2008/10/01'

"shiftdate" is probably a DATE column; you should NOT guess database's default date format as it might change (after migration to a higher version, porting your code to another database, ...). The right way would be taking care about dates personally; I, for example, don't know whether 2008/10/01 means October 1st or January 10th. Therefore, try to correct the code in the future:
where shiftdate = TO_DATE('2008/10/01', 'yyyy/mm/dd')
Re: ODBC connection in Forms 4.5 [message #359211 is a reply to message #359132] Fri, 14 November 2008 02:58 Go to previous messageGo to next message
kelp
Messages: 10
Registered: October 2008
Junior Member
Dear Sir,

Milk_collection is a view.

If i retrieve data directly from table, it does not display data correctly in forms.

So, as par your hint i am using View based on table.

shiftdate = '2008/10/01' means 'YYYY/MM/dd'.

Further i want to inform you that i have tried by convert the data type of varchar to char in sql server while creating View. And make bigger the size of field. And then added the '-' character at the end of the field value. The data shows like bellow in Sql Server.

Field "DBC" and value "SOUR -"

In the original Table the data in shift field like bellow.

Field "DBC" and value "SOUR"

Then also the problem is same. i. e. Data comes in forms through CURSOR as bellow.

Field "DBC" and value "SOU"

Waiting for reply.

Thanks.
Re: ODBC connection in Forms 4.5 [message #359483 is a reply to message #359211] Sun, 16 November 2008 21:00 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
I stand by my comment "I think that there is a 2-byte length at the beginning of each field. Use something like substr(field,3) to get the data."

Please try my suggestion.

David
Previous Topic: Problem opening form module from another form module
Next Topic: Restrict User
Goto Forum:
  


Current Time: Sat Dec 10 03:05:38 CST 2016

Total time taken to generate the page: 0.22945 seconds