Collections returning
I am having difficulty getting two records out of a function when using
collection. I don't know what I am doing wrong, thank you in advance for any
help.
Service calling function...
Announcements announcements = new Announcements(ID, moduleID, _config, _logger);
return announcements; // this does not contain anything although Announcements load functions has two record
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public List<Announcement> announcements = new List<Announcement>();
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
Load(employeeID, moduleID);
}
}
public virtual void Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
announcements.Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
return announcements; *** this has 2 records
}
}
}
c# .net rest api
add a comment |
I am having difficulty getting two records out of a function when using
collection. I don't know what I am doing wrong, thank you in advance for any
help.
Service calling function...
Announcements announcements = new Announcements(ID, moduleID, _config, _logger);
return announcements; // this does not contain anything although Announcements load functions has two record
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public List<Announcement> announcements = new List<Announcement>();
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
Load(employeeID, moduleID);
}
}
public virtual void Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
announcements.Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
return announcements; *** this has 2 records
}
}
}
c# .net rest api
you call a function with the keyword void (which means no return value), and then try to call a return function ? That do not work.
– Glowhollow
Jan 18 at 16:11
1
Announcements : List<Announcement>
don't do this. See this question for an explanation of why
– A Friend
Jan 18 at 16:15
add a comment |
I am having difficulty getting two records out of a function when using
collection. I don't know what I am doing wrong, thank you in advance for any
help.
Service calling function...
Announcements announcements = new Announcements(ID, moduleID, _config, _logger);
return announcements; // this does not contain anything although Announcements load functions has two record
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public List<Announcement> announcements = new List<Announcement>();
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
Load(employeeID, moduleID);
}
}
public virtual void Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
announcements.Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
return announcements; *** this has 2 records
}
}
}
c# .net rest api
I am having difficulty getting two records out of a function when using
collection. I don't know what I am doing wrong, thank you in advance for any
help.
Service calling function...
Announcements announcements = new Announcements(ID, moduleID, _config, _logger);
return announcements; // this does not contain anything although Announcements load functions has two record
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public List<Announcement> announcements = new List<Announcement>();
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
Load(employeeID, moduleID);
}
}
public virtual void Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
announcements.Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
return announcements; *** this has 2 records
}
}
}
c# .net rest api
c# .net rest api
edited Jan 18 at 16:12
User
54.6k676123
54.6k676123
asked Jan 18 at 16:09
Rocio BordaRocio Borda
92
92
you call a function with the keyword void (which means no return value), and then try to call a return function ? That do not work.
– Glowhollow
Jan 18 at 16:11
1
Announcements : List<Announcement>
don't do this. See this question for an explanation of why
– A Friend
Jan 18 at 16:15
add a comment |
you call a function with the keyword void (which means no return value), and then try to call a return function ? That do not work.
– Glowhollow
Jan 18 at 16:11
1
Announcements : List<Announcement>
don't do this. See this question for an explanation of why
– A Friend
Jan 18 at 16:15
you call a function with the keyword void (which means no return value), and then try to call a return function ? That do not work.
– Glowhollow
Jan 18 at 16:11
you call a function with the keyword void (which means no return value), and then try to call a return function ? That do not work.
– Glowhollow
Jan 18 at 16:11
1
1
Announcements : List<Announcement>
don't do this. See this question for an explanation of why– A Friend
Jan 18 at 16:15
Announcements : List<Announcement>
don't do this. See this question for an explanation of why– A Friend
Jan 18 at 16:15
add a comment |
2 Answers
2
active
oldest
votes
A Friends comment could be right, but I don't know your use case so maybe it is valid.
As sort of stated in other comments/answers the Load method doesn't return anything so your line
return announcements;
does nothing.
Your are actually adding the items to the internal list you have.
So I'm guessing with your current code, this would work to show you your two items in your service code.
Announcements announcements = new Announcements(ID, moduleID, _config, _logger);
return announcements.announcements;
Obviously that looks confusing and isn't what you wanted. Since you are inheriting from List what you want to do is add the items to itself in the Load function. So I believe the following code would work. The key being to use just Add instead of announcements.Add
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
Load(employeeID, moduleID);
}
}
public virtual void Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
}
}
}
New contributor
add a comment |
Not sure if that works.
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public List<Announcement> announcements = new List<Announcement>();
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
var value = Load(employeeID, moduleID);
}
}
public virtual List<Announcement> Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
announcements.Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
return announcements; *** this has 2 records
}
}
}
i hope that clarify something....
greetings
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54257607%2fcollections-returning%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
A Friends comment could be right, but I don't know your use case so maybe it is valid.
As sort of stated in other comments/answers the Load method doesn't return anything so your line
return announcements;
does nothing.
Your are actually adding the items to the internal list you have.
So I'm guessing with your current code, this would work to show you your two items in your service code.
Announcements announcements = new Announcements(ID, moduleID, _config, _logger);
return announcements.announcements;
Obviously that looks confusing and isn't what you wanted. Since you are inheriting from List what you want to do is add the items to itself in the Load function. So I believe the following code would work. The key being to use just Add instead of announcements.Add
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
Load(employeeID, moduleID);
}
}
public virtual void Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
}
}
}
New contributor
add a comment |
A Friends comment could be right, but I don't know your use case so maybe it is valid.
As sort of stated in other comments/answers the Load method doesn't return anything so your line
return announcements;
does nothing.
Your are actually adding the items to the internal list you have.
So I'm guessing with your current code, this would work to show you your two items in your service code.
Announcements announcements = new Announcements(ID, moduleID, _config, _logger);
return announcements.announcements;
Obviously that looks confusing and isn't what you wanted. Since you are inheriting from List what you want to do is add the items to itself in the Load function. So I believe the following code would work. The key being to use just Add instead of announcements.Add
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
Load(employeeID, moduleID);
}
}
public virtual void Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
}
}
}
New contributor
add a comment |
A Friends comment could be right, but I don't know your use case so maybe it is valid.
As sort of stated in other comments/answers the Load method doesn't return anything so your line
return announcements;
does nothing.
Your are actually adding the items to the internal list you have.
So I'm guessing with your current code, this would work to show you your two items in your service code.
Announcements announcements = new Announcements(ID, moduleID, _config, _logger);
return announcements.announcements;
Obviously that looks confusing and isn't what you wanted. Since you are inheriting from List what you want to do is add the items to itself in the Load function. So I believe the following code would work. The key being to use just Add instead of announcements.Add
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
Load(employeeID, moduleID);
}
}
public virtual void Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
}
}
}
New contributor
A Friends comment could be right, but I don't know your use case so maybe it is valid.
As sort of stated in other comments/answers the Load method doesn't return anything so your line
return announcements;
does nothing.
Your are actually adding the items to the internal list you have.
So I'm guessing with your current code, this would work to show you your two items in your service code.
Announcements announcements = new Announcements(ID, moduleID, _config, _logger);
return announcements.announcements;
Obviously that looks confusing and isn't what you wanted. Since you are inheriting from List what you want to do is add the items to itself in the Load function. So I believe the following code would work. The key being to use just Add instead of announcements.Add
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
Load(employeeID, moduleID);
}
}
public virtual void Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
}
}
}
New contributor
New contributor
answered Jan 18 at 18:04
Dan SponsellerDan Sponseller
12
12
New contributor
New contributor
add a comment |
add a comment |
Not sure if that works.
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public List<Announcement> announcements = new List<Announcement>();
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
var value = Load(employeeID, moduleID);
}
}
public virtual List<Announcement> Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
announcements.Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
return announcements; *** this has 2 records
}
}
}
i hope that clarify something....
greetings
add a comment |
Not sure if that works.
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public List<Announcement> announcements = new List<Announcement>();
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
var value = Load(employeeID, moduleID);
}
}
public virtual List<Announcement> Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
announcements.Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
return announcements; *** this has 2 records
}
}
}
i hope that clarify something....
greetings
add a comment |
Not sure if that works.
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public List<Announcement> announcements = new List<Announcement>();
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
var value = Load(employeeID, moduleID);
}
}
public virtual List<Announcement> Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
announcements.Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
return announcements; *** this has 2 records
}
}
}
i hope that clarify something....
greetings
Not sure if that works.
namespace Api.Collection
{
public class Announcements : List<Announcement>
{
IConfiguration _config;
ILoggerManager _logger;
private string _uspGetAnnouncement = "storedproced_GetAnnouncemnt";
public List<Announcement> announcements = new List<Announcement>();
public Announcements()
{
}
public Announcements(int employeeID, int moduleID, IConfiguration config, ILoggerManager logger)
{
_config = config;
_logger = logger;
if (employeeID > 0 && moduleID > 0)
{
var value = Load(employeeID, moduleID);
}
}
public virtual List<Announcement> Load(int employeeID, int moduleID)
{
List<SqlParameter> lParam = new List<SqlParameter>();
Util.DataUtil dataUtil = new Util.DataUtil(_config);
SqlParameter param;
if (employeeID > 0 && moduleID > 0)
{
param = new SqlParameter("@employeeID", employeeID);
lParam.Add(param);
param = new SqlParameter("@moduleID", moduleID);
lParam.Add(param);
}
DataTable dt = Util.GetDataTable(_uspGetAnnouncement, lParam.ToArray());
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
announcements.Add(new Announcement(dr, dt.Rows.Count, _config, _logger));
}
}
return announcements; *** this has 2 records
}
}
}
i hope that clarify something....
greetings
answered Jan 18 at 16:17
GlowhollowGlowhollow
579
579
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54257607%2fcollections-returning%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
you call a function with the keyword void (which means no return value), and then try to call a return function ? That do not work.
– Glowhollow
Jan 18 at 16:11
1
Announcements : List<Announcement>
don't do this. See this question for an explanation of why– A Friend
Jan 18 at 16:15