When I run this SQL, I get this error
This is the second SQL I run, but I tried running the 1st SQL that works twice and a row and it worked fine, so maybe not a open connection issue?
A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a send to call) no address was supplied.
last time I got that error, in very similar code, it was because I left the "@" off the variable name in the args section.
So I strongly suspect this is the bad generic error for "Your SQL calling code is messed up somehow" or "that returned 0 rows"(man, I hope its not the latter)
public List<EnrTypeSepInfoCV> GetEnrTypeSepInfo(long enrId)
{
var aseSqlConnectionString = configuration.GetConnectionString("SybaseDBDapper");
string sql = "";
sql += "select et.enrtype_id, ";
sql += " et.active as stud_status, ";
sql += " s.sep_dt ";
sql += "from enrollment_type et,separation s ";
sql += "where et.enrtype_id *= s.enrtype_id ";
sql += "and et.enr_id = @al_enr_id ";
dapperTools.DapperCustomMapping<EnrTypeSepInfoCV>();
try
{
using (IDbConnection db = new AseConnection(aseSqlConnectionString))
{
var arguments = new
{
@al_enr_id = enrId
};
List<EnrTypeSepInfoCV> ll = new List<EnrTypeSepInfoCV>();
ll = db.Query<EnrTypeSepInfoCV>(sql, arguments).ToList();
return ll;
}
}
catch (Exception ex)
{
Trace.WriteLine(ex.ToString());
return null;
}
}
If I pull the SQL out, replace the variable with the passed in value everything works.
I looked line by line comparing this to a working SQL call method and I can't see any differences. Anyone know what I did wrong?
Is there a way to get more informative errors in situations like this?
If it matters, I'm writing a .Net Core web API Service to be consumed by a Vue app running against a Sybase DB v12.*.
I have other API methods working correctly, that call the DB the same way.
Here is my data object
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SpProofOfConceptAPI.Dto
{
public class EnrTypeSepInfoCV
{
[Dapper.Column("enrtype_id")]
public Int64 EnrTypeId { get; set; }
[Dapper.Column("stud_status")]
public string StudStatus { get; set; }
[Dapper.Column("sep_dt")]
public DateTime? SepDt { get; set; }
}
}
Okay,
So this message appears to be a generic "something went wrong connecting" message.
In my case, it was the connection timeout expiring. the Default is 15s, I changed it to 600s, and it's working fine. (We have some long running reports that can take a long time)
Since it's on ASE, I just added 'Connection Timeout = 600;'.