Defines a named recordset, for use with databases, replacing any existing recordset with the same name.
Visual Basic |
---|
Public Function DefineRecordset( _ ByVal rs As String, _ ByVal connect As String, _ ByVal tables As String, _ ByVal columns As String, _ ByVal aliases As String, _ ByVal sqlwhere As String _ ) As String |
The connect argument enables SIS to connect to the database containing the data to be mapped. The methods you can use to connect to a database are:
DSN=DataSourceName
DATABASE=DatabasePathName
UID=UserName
PWD=Password
LOGINTIMEOUT=seconds
ODBC;DSN=Anything;DATABASE=C:\test.mdb;UID=MyName;PWD=topsecret
Server=HostString
User=UserName
Password=Password
OracleCI;server=MyServer;user=UserName;Password=Password;Plaintext=True
True
. For encrypted passwords the Plaintext parameter must be omitted.In order to define a recordset from a CSV file (e.g. for subsequently creating a View Points overlay using “CreateDbPointOverlay”), the database connection string must be appended with a JSON string.
The following is a sample code in a C# environment:
string strConn = "CSV;<json configuration>";
@"CSV;
{
"FileName": "G:\\Data\\incidents.csv",
"CodePage" : 1252,
"FileFormat" : "delimited",
"FirstRowContainsFieldNames" : true,
"FieldDelimiter" : ",",
"SkipLinesMatching" : "1",
"HeaderLines" : 3,
"KeepFirstLine" : true,
"FooterLines" : 0,
"DateOrder" : "DMY",
"Columns" : [
{
"Name" : "newColumnName",
"Type" : "double"
},
{
"Name" : "newColumnNameB",
"Type" : "double"
}
]
}
SIS.DefineRecordset("rs", strConn, "incidents,incidents", "originx,originy", "originx#,originy#", "" );
Note: All parameters in this code are optional, except for FileName and Columns. Missing fields will be guessed by the CSV database connection.
The parameters that may be used for the Skip Lines options in a CSV file are; SkipLinesMatching, HeaderLines, KeepFirstLine, FooterLines.
The full database connection string used.
Available: GEO MM ME MD OD OM SISpy
Groups:
sis.DefineRecordset ("Depths", "", "Soundings,Soundings", "Northing,Easting", "X#,Y#", "Depth < 0")
Note: In the comma-delimited list in the example there must not be any spaces, i.e. "Soundings,Soundings" is correct but "Soundings, Soundings" (with a space) would not be correct.
Send comments on this topic.
Click to return to www.cadcorp.com
© Copyright 2000-2017 Computer Aided Development Corporation Limited (Cadcorp).