I'm calling sybase ase via Dapper with parameterized sql in .NetCore 2.
I keep getting the "A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied." error
but the error seems to mean "something went wrong" Its been bad data ypes on return object, connection timeouts etc.
I'm spending a ton of time trying to brute force debug these errors. Is there a better way to debug these to get to the root issue?
example working code:
var aseSqlConnectionString = Configuration.GetConnectionString("SybaseDBDapper");
StringBuilder query = new StringBuilder();
query.Append("SELECT stud_id, ad_guid, ad_name, ad_pass_expire_dt, ad_last_login_dt, alumni");
query.Append(" from student ");
query.Append(" where LOWER( ad_name ) = Lower( @studentAdName ) ");
string sql = query.ToString();
DapperTools.DapperCustomMapping< StudentAdDataResponse >( );
try
{
using ( IDbConnection db = new AseConnection(aseSqlConnectionString) )
{
var arguments = new
{
studentAdName = sAdName,
};
List< StudentAdDataResponse > ll = new List< StudentAdDataResponse >();
//StudentAdDataResponse res = db.QueryFirst<StudentAdDataResponse>(sql, arguments);
//ll.Add( res );
ll = db.Query<StudentAdDataResponse>(sql, arguments).ToList();
return ll;
}
}
catch (Exception ex)
{
Trace.WriteLine( ex.ToString( ) );
return null;
}
example bad code
string sql = " SELECT period.period_day_cd, " +
" period.period_no, " +
" period.period_start_tm, " +
" period.period_end_tm, " +
" classroom.clsrm_loc_cd, " +
" classroom.clsrm_no, " +
" course.course_name, " +
" student_schedule.stud_sched_eff_dt, " +
" student_schedule.sched_type_cd, " +
" code.code_desc, " +
" staff.staff_lname, " +
" staff.staff_fname, " +
" staff.staff_mi, " +
" 'N' as first_eff_dt" +
" FROM code, " +
" classroom, " +
" course, " +
" period, " +
" staff, " +
" student_schedule, " +
" class, " +
" class_period, " +
" schedule_item, " +
" stud_class_sched " +
" WHERE ( student_schedule.sched_type_cd = code.code_id ) and " +
" ( class.clsrm_id = classroom.clsrm_id ) and " +
" ( schedule_item.sched_item_id = course.sched_item_id ) and " +
" ( student_schedule.stud_sched_id = stud_class_sched.stud_sched_id ) and " +
" ( class_period.cls_period_id = stud_class_sched.cls_period_id ) and " +
" ( class_period.period_id = period.period_id ) and " +
" ( class_period.cls_id = class.cls_id ) and " +
" ( class.staff_id = staff.staff_id ) and " +
" ( class.sched_item_id = schedule_item.sched_item_id ) and " +
" ( student_schedule.enrtype_id = @enrtypeid ) " +
" order by student_schedule.stud_sched_eff_dt desc, " +
" code.code_desc, " +
" period.period_day_cd, " +
" period.period_start_tm ";
var aseSqlConnectionString = configuration.GetConnectionString("SybaseDBDapper");
dapperTools.DapperCustomMapping<StdInfoScheduleCV>();
try
{
List<StdInfoScheduleCV> ll = new List<StdInfoScheduleCV>();
using ( IDbConnection db = new AseConnection( aseSqlConnectionString ) )
{
try
{
db.Open( );
var arguments = new
{
enrtypeid = EnrTypeId,
};
ll = jcdcDbQuery< StdInfoScheduleCV >( db, sql, arguments );
}
catch ( Exception ex )
{
throw;
}
finally
{
db.Close();
}
return ll;
}
}
catch ( Exception ex )
{
Trace.WriteLine(ex.ToString());
//return new List< StdInfoScheduleCV >();
throw;
}
I've tried everything I can think of, but can't find the issue.
What steps can I take to diagnose the Sybase ASE + Dapper issue.
The non working code was ported over from a working asp.net mvc 4.5 app, and the db code converted to dapper and .netcore