コミュニティ

How to extract data from database

Hi 

I want to get data from database into a field. 

Here's what I wrote: 

using System;

using System.IO;

using System.Collections.Generic;

using System.Diagnostics;

using ABBYY.FlexiCapture;


string connectionString = "Driver={SQL Server};Server=localhost\\SQLEXPRESS;Database=database;Uid=sa;Pwd=xxxxx;";

string Query1 = "SELECT somerecord FROM t1";


PrepareRecordset( connectionString, selectString );

Int recordCount = RecordCount( connectionString, selectString );

string searchString;

RectArray searchArea = RectArray();

for (int recordIndex = 0; recordIndex < recordCount - 1; recordIndex++) {

StringArray recordArray = Record( connectionString, selectString, recordIndex );

if ( recordIndex == 0 ){

searchString = recordArray.GetAt( 0 );

} else {

searchString = searchString + "|" + recordArray.GetAt( 0 );

}

searchArea.Add(recordArray.GetAt( 1 ));

}

SearchText: searchString;

RSA: searchArea;


Context.Field("Field).Text = Query1;

However, I get error. 

I do not think PrepareRecordset can be used in rule script, but I could not find what to use in FlexiCapture. 

 

 

How do I connect to database, get data, and put that data into a field from script rule?

Any ideas would be appreciated.

 

Thank you, 

 

 

この記事は役に立ちましたか?

0人中0人がこの記事が役に立ったと言っています

コメント

1件のコメント

  • Avatar
    Permanently deleted user

    Hello,

    Could you please describe your scenario in more details? Where is this script located? Please provide the text of the error message.

    0

サインインしてコメントを残してください。