I want the same thing with sql instead of linq to sql: and i want to return the value to this :
ddlIPAddress.DataSource = dal.GetDeviceType();
public List<IPMaster> GetDeviceType()
{
try
{
// creating new object for connection with callcenter database
ZCLSWEBDataContext ZCLS = new ZCLSWEBDataContext(new OdbcConnection(strConnection));
// execute query
var result = from s in ZCLS.IPMasters
orderby s.DeviceName
select s;
// return result set
if (result != null)
return result.ToList();
else
return null;
}
catch
{
return null;
}
}
Go to the complete details ...