Syncing with Remote Database failing

Submitted by prashant on 2025/06/29 14:02

HI,

I have database on local machine which I am trying to sync . 

localhost\sqlexpress
database - items
username- xx | password xxx
table - quickcapture
primarykey - recordid
column to sync - Task

This is 100% working connection string , tested via powershell

$connectionString = "Server=localhost\SQLEXPRESS;Database=items;User ID=xx;Password=xxx;Trusted_Connection=False"
$connection = New-Object System.Data.SqlClient.SqlConnection $connectionString

try {
   $connection.Open()
   Write-Output "Connection successful!"
}
catch {
   Write-Output "Connection failed: $($_.Exception.Message)"
}
finally {
   $connection.Close()
}

  • I tried the following script below , but when i try to run with below I get the error 1 fields found for mapping but database connection OK but sql query failed
  • Sometimes I get the errro recordid field not found in databaes , I can 100% confrim I have created a custom field (text) for the same
  • SELECT recordid, Task AS Item FROM dbo.quickcapture -> This 100% confirm works

<ConnectionString>PROVIDER=MSOLEDBSQL;PASSWORD=xxx;PERSIST SECURITY INFO=TRUE;USER ID=xx;INITIAL CATALOG=items;DATA SOURCE=localhost\SQLEXPRESS;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096</ConnectionString>

<FieldMap>
[recordid] recordid
[Task] Item
</FieldMap>
<Source>
SELECT recordid, Task AS Item FROM dbo.quickcapture
</Source>
<RecordIDField>recordid</RecordIDField>
<RecordStatus>IDStatusSQL ADD UPDATE</RecordStatus>

Comments

Hi,

  1. Did you try removing the dbo. from the FROM clause?
  2. Also, if your SQL has Task as Item, then the field name is Item, not [Task] (in the field mapping). I suggest this SQL: SELECT recordid, Task FROM quickcapture

HTH!

Hi,

I modified the sql table to have only two records now recordid,item now

<FieldMap>
[recordid] recordid
[item] item
</FieldMap>
<Source>
SELECT recordid, item FROM dbo.quickcapture
</Source>
<RecordIDField>recordid</RecordIDField>
<RecordStatus>IDStatusSQL ADD UPDATE</RecordStatus>

1 field found for mapping. RecordID field not found (recordid is not a filed in your IQBase). 

I think the error is arising from <RecordIDField>recordid</RecordIDField>
when I do 
I think the error is arising from <RecordIDField>IDSQL</RecordIDField> i get same error as above

 

 

I had a text field named recordid , which I change to numeric but same result. aka recordid not found 

but sometimes I get different error

1 field found for mapping. Database conneciton OK but sql query failed. Parsed will open. TempSQLCommand text file opens with below commmand 1 field found for mapping. 
SELECT recordid,item FROM quickcapture --> This commands works fine when testing

 

Can you share the server database structure ? (aka field list)

(I thought the server field was named Task... so SELECT Item would of course fail, as this field does not exist on the server)

I had modified the sql table to better simplify the query but regarless schema is simple 

table name - quickcapture , only two columns  . Microsoft SQL 2019 , database - items

  1. recordid - int - primary key
  2. item - nvarchar(max) 

     

 

How do I ?