Options

Data Exhausted error in IronPython script

sbendayansbendayan Posts: 18 Bronze 1
edited February 6, 2017 10:02AM in SQL Data Generator
Greetings,

I am trying to populate a complex FK scenario with the Python script below and am getting the error 'Data exhausted for field 'TenantId''.

Can anyone tell me what I'm doing wrong?


def main(config):
import System.Data.SqlClient
connection = System.Data.SqlClient.SqlConnection(config["connection_string"])
command = System.Data.SqlClient.SqlCommand("SELECT Top 1 LegalEntityCompanyId FROM dbo.Companies WHERE TenantId = '" + TenantId + "'", connection)
connection.Open()
value = command.ExecuteScalar()
connection.Close()
return value

Comments

Sign In or Register to comment.