Using SetAdoConnection() with SqlAnyWhere in Pb2022R2 occour appcrash when call "connect using sqlca";
My Code : (CPU : Windows 11 Pro - 22621.2283)
//////////////////////////////////////////////////
// My code in Pb2022 R2:
//////////////////////////////////////////////////
boolean lb_retVal
long ll_return, ll_result
dotnetobject lcs_obj
dotnetassembly lcs_ass
lcs_obj = create dotnetobject
lcs_ass = create dotnetassembly
ll_return = lcs_ass.LoadWithDotNet("C:\Codes\PoderAdoDb.dll")
if ll_return < 0 then
messagebox("Fail - Open PoderAdoDb.dll",lcs_ass.errortext)
return
end if
ll_return = lcs_ass.createinstance("PoderAdoDb.PoderDbConnect",lcs_obj)
if ll_return < 0 then
messagebox("createinstance failed",lcs_ass.errortext)
return
end if
lb_retVal = SQLCA.SetAdoConnection(lcs_obj.odbcSql)
if lb_retVal then
connect using SQLCA; // <- APPCrash pb220.exe //////////////////
if sqlca.sqlcode <> 0 then
messagebox("Error",sqlca.sqlerrtext)
else
select count(*) into :ll_result from dba.empresa;
messagebox("Result",ll_result)
end if
else
messagebox("","Fail - SetAdoConnection")
end if
//////////////////////////////////////////////////
// End - Code Pb2022 - r2
//////////////////////////////////////////////////
//////////////////////////////////////////////////
// My code in C#- SnapDevelop:
//////////////////////////////////////////////////
using Appeon.DB.Sharing;
using System.Data.Odbc;
namespace PoderAdoDb
{
public class PoderDbConnect
{
public IAdoConnectionProxy odbcSql { get; set; }
public OdbcConnection sqlcon;
private string connection = "Dsn=OFF17";
public PoderDbConnect()
{
sqlcon = new OdbcConnection(connection);
sqlcon.Open();
odbcSql = new AdoConnectionProxy { Connection = sqlcon };
}
}
}
//////////////////////////////////////////////////
// End code in C#- SnapDevelop
//////////////////////////////////////////////////