So this is going to sound very simple to those of you who use sql but I've have never used sql so here goes....
All I need to do is:
-Connect to the SQL server
-Add a new record
-Add the data to the record (2 fields "Name" and "ID")
-Save and close
I've looked at some posts but I see different people doing things different ways and now I'm confused
I should also mention that I've been out of the programming game for a while and am a bit rusty.
Can anyone point me in the right direction?
SQL connection
- Jeff Barnes
- Posts: 933
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
SQL connection
Thanks,
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
- Jeff Barnes
- Posts: 933
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Re: SQL connection
Forgot to mention that it's a Microsoft SQL server I need to connect to.
Thanks,
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
Re: SQL connection
Hi, Jeff, nice to see you again. It seems like you haven't been here for a long time.
I've often wondered if you're still working on your program. Unfortunately,
I've shut down all my SQL servers and haven't done anything with them for a long time. But I'm happy to see you.
Best regards,
Otto
I've often wondered if you're still working on your program. Unfortunately,
I've shut down all my SQL servers and haven't done anything with them for a long time. But I'm happy to see you.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Jeff Barnes
- Posts: 933
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Re: SQL connection
Hi Otto,
Nice to see you again too
I retired back in 2020 but still do a bit of programming here and there.
Glad to see your still going
Nice to see you again too
I retired back in 2020 but still do a bit of programming here and there.
Glad to see your still going
Thanks,
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: SQL connection
This is our recommendation:
You can test this program from your computer.
This program connects to a FWH's MsSql server in the cloud. This server is provided for testing by our users.
After testing this, you can use similar logic on your Server.
Code: Select all | Expand
function TestMsSql()
local oCn, cSql, oRs
// server // db // user // pwd
oCn := FW_OpenAdoConnection( "MSSQL,208.91.198.196,gnraore3_,fwhmsdemo,fwh@2000#", .t. )
if oCn == nil
? "failed to connect"
else
cSql := "INSERT INTO [STATES] ( [CODE], [NAME] ) VALUES ( 'JB', 'Jeff Barnes' )"
oCn:Execute( cSql )
//
// Now test
oRs := FW_OpenRecordSet( oCn, "SELECT * FROM [STATES]" )
XBROWSER oRs
oRs:Close()
oCn:Close()
endif
return nil
You can test this program from your computer.
This program connects to a FWH's MsSql server in the cloud. This server is provided for testing by our users.
After testing this, you can use similar logic on your Server.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Jeff Barnes
- Posts: 933
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Re: SQL connection
Thank you sir. That works when I leave your sample alone.
When I add my connection info, it will not connect.
At least now I know it should work. Not sure why the connection isn't working on my end.
The big issue is me, I just don't know enough about the SQL Server.
Even if I create logins on the server (ie: User=Jeff), It will not let me connect unless I use "Windows Authentication". I think this is where my issue is.
I will keep on trying.
When I add my connection info, it will not connect.
At least now I know it should work. Not sure why the connection isn't working on my end.
The big issue is me, I just don't know enough about the SQL Server.
Even if I create logins on the server (ie: User=Jeff), It will not let me connect unless I use "Windows Authentication". I think this is where my issue is.
I will keep on trying.
Thanks,
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
- Jeff Barnes
- Posts: 933
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Re: SQL connection
Got it working. It was a setting in MS-SQL. I had to enable both Windows Authentication and SQL user authentication.
Thanks again for the help.
Thanks again for the help.
Thanks,
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)