Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic cursoradapter & grid
Message
From
30/05/2005 06:27:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
30/05/2005 04:34:14
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01018489
Message ID:
01018501
Views:
10
>Hello all!
>I'm quite new to VFP so pls bear with me.
>
>I'm trying various ways to connect to a SQL Server 2000.
>I've found this nice code (which works) :
>
>local loCursor as CursorAdapter, ;
> laErrors[1]
>set multilocks on
>loCursor = createobject('CursorAdapter')
>with loCursor
> .Alias = 'Customers'
> .DataSourceType = 'ODBC'
>*** Use appropriate connection settings here
> .DataSource = sqlstringconnect('driver=SQL Server;' + ;
> 'server=(local);database=Northwind;uid=sa;pwd=;' + ;
> 'trusted_connection=no')
> .SelectCmd = "select CUSTOMERID, COMPANYNAME, CONTACTNAME " + ;
> "from CUSTOMERS where COUNTRY = 'Brazil'"
> .KeyFieldList = 'CUSTOMERID'
> .Tables = 'CUSTOMERS'
> .UpdatableFieldList = 'CUSTOMERID, COMPANYNAME, CONTACTNAME'
> .UpdateNameList = 'CUSTOMERID CUSTOMERS.CUSTOMERID, ' + ;
> 'COMPANYNAME CUSTOMERS.COMPANYNAME, CONTACTNAME CUSTOMERS.CONTACTNAME'
>
> if .CursorFill()
> BROWSE
> else
> aerror(laErrors)
> messagebox(laErrors[2])
> endif .CursorFill()
>ENDWITH
>
>Now instead of Browse, I would like to use a grid.
>My question is what should I pass to
>thisform.grdDynamic.RecordSource and thisform.grdDynamic.RecordSourceType?
>Thank you very much

Grid.Recordsource = "Customers" && Alias of CA
Leave Recordsourcetype as its default (alias)

PS: Trusted_connection = no, user_id=sa with no pwd is a security risk. It'd be better if you used Trusted_connection=yes and no uid,pwd.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform