Page 1 of 1

mod harbour connected to MS SQL

Posted: Mon Apr 12, 2021 8:07 pm
by Otto
Dear friends,

Mr. Rao shows us how we can connect from mod harbour to MS SQL.

You see mod harbour working against MSSQL. For this to work you need to first install Microsoft OLEDB driver for SQL:
Download Link:
https://docs.microsoft.com/.../download ... iver-for...
Please download 64-bit version and install.
Then the above program will run in mod-harbour.
Note: We do not need to install SQL server on our PC/Server
The name of the installation file you downloaded should be "msoledbsql.msi".
After installing this and restarting the computer, you should find "c:\windows\system32\msoledbsql.dll"
That means the installation is complete.

Best regards,
Otto
Image

Re: mod harbour connected to MS SQL

Posted: Mon Apr 12, 2021 9:06 pm
by cnavarro
Dear Otto
Link not run

Re: mod harbour connected to MS SQL

Posted: Mon Apr 12, 2021 9:23 pm
by nageswaragunupudi
Function to generate HTML table from a RecordSet.
This code does not depend on FWH and can be used in any non-fwh Harbour application.

Code: Select all | Expand

function RecordSetToHTML( oRs, lHtmlPage )

   local cHTML := ""
   local bm, n

   cHTML := [<table border="1" width="100%">]
   cHTML += "<tr>"
   for n := 0 to oRs:Fields:Count() - 1
      cHTML += ( "<td><b>" + oRs:Fields( n ):Name + "</b></td>" )
   next
   cHTML += "</tr>"

   if oRs:RecordCount() > 0
      bm    := oRs:Bookmark
      oRs:MoveFirst()
      cHTML += "<tr><td>"
      cHTML += oRs:GetString( 2, oRs:RecordCount(), "</td><td>","</td></tr><tr><td>","&nbsp;" )
      cHTML += "</td></tr>"
      oRs:MoveFirst()
      oRs:BookMark   := bm
   endif
   cHTML += "</table>"

   if lHtmlPage == .t.
      cHTML := "<html>" + CRLF + "<body>" + CRLF + cHTML + CRLF + "</body>" + CRLF + "</html>"
   endif

return cHTML

Re: mod harbour connected to MS SQL

Posted: Mon Apr 12, 2021 9:26 pm
by nageswaragunupudi
cnavarro wrote:Dear Otto
Link not run


https://docs.microsoft.com/en-us/sql/co ... rver-ver15

"https://docs.microsoft.com/en-us/sql/connect/oledb/download-oledb-driver-for-sql-server?view=sql-server-ver15"

Re: mod harbour connected to MS SQL

Posted: Mon Apr 12, 2021 9:38 pm
by Otto
Dear Mr. Rao,
Thank you.
It is working fine.

Image

Best regards,
Otto

Re: mod harbour connected to MS SQL

Posted: Mon Apr 12, 2021 9:46 pm
by nageswaragunupudi
Wonderful.
Thank you.