By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,763 Members | 1,641 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,763 IT Pros & Developers. It's quick & easy.

add results to dataset

P: n/a
Ok, I hit a wall and I'm stuck. I have a web form that has a textbox were
the user can enter in 1 to many usernames, then the user has to validate the
user to make sure the user exists. I have a stored procedure that can only
take one username at a time, so I need to keep calling this stored procedure
with all of the usernames in the textbox( i have this portion working). The
issue I'm running into is that only the data for the last username passed to
the stored procedure is being passed back so if I enter in

JSmith, SLong, SHenry,

I'm only getting the details for SHenry, though I need to store and use the
details for all 3 users so I can add them to the user table.

so when I click the add buttong, its storing:
JSmith, SLong, SHenry in the user column of the table BUT storing SHenry,
phone number, email address etc. I need a row for each user with their own
information
So I either need somehow to keep adding it to the existing dataset or
somethign.

any suggestions on how to do this?

Jul 11 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
On Jul 11, 4:55 pm, "Steve" <S...@community.nospam.comwrote:
Ok, I hit a wall and I'm stuck. I have a web form that has a textbox were
the user can enter in 1 to many usernames, then the user has to validate the
user to make sure the user exists. I have a stored procedure that can only
take one username at a time, so I need to keep calling this stored procedure
with all of the usernames in the textbox( i have this portion working). The
issue I'm running into is that only the data for the last username passed to
the stored procedure is being passed back so if I enter in

JSmith, SLong, SHenry,

I'm only getting the details for SHenry, though I need to store and use the
details for all 3 users so I can add them to the user table.

so when I click the add buttong, its storing:
JSmith, SLong, SHenry in the user column of the table BUT storing SHenry,
phone number, email address etc. I need a row for each user with their own
information

So I either need somehow to keep adding it to the existing dataset or
somethign.

any suggestions on how to do this?
Can we see the code of the stored procedure?

Jul 11 '07 #2

P: n/a
the stored procedure is actually a select statement that calls a view which
is doing a select, joins, etc on tables.
but the stored procedure is

select * from vGetUserInformation where ID = @id

and the view is doing all of the work
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
On Jul 11, 4:55 pm, "Steve" <S...@community.nospam.comwrote:
>Ok, I hit a wall and I'm stuck. I have a web form that has a textbox were
the user can enter in 1 to many usernames, then the user has to validate
the
user to make sure the user exists. I have a stored procedure that can
only
take one username at a time, so I need to keep calling this stored
procedure
with all of the usernames in the textbox( i have this portion working).
The
issue I'm running into is that only the data for the last username passed
to
the stored procedure is being passed back so if I enter in

JSmith, SLong, SHenry,

I'm only getting the details for SHenry, though I need to store and use
the
details for all 3 users so I can add them to the user table.

so when I click the add buttong, its storing:
JSmith, SLong, SHenry in the user column of the table BUT storing SHenry,
phone number, email address etc. I need a row for each user with their
own
information

So I either need somehow to keep adding it to the existing dataset or
somethign.

any suggestions on how to do this?

Can we see the code of the stored procedure?

Jul 11 '07 #3

P: n/a
On Jul 11, 7:45 pm, "Steve" <S...@community.nospam.comwrote:
the stored procedure is actually a select statement that calls a view which
is doing a select, joins, etc on tables.
but the stored procedure is

select * from vGetUserInformation where ID = @id

and the view is doing all of the work
Well, then it's something the code I guess... Need to see it :-)

Jul 11 '07 #4

P: n/a
need to see what? the .net code or the SQL code?

"Alexey Smirnov" <al************@gmail.comwrote in message
news:11*********************@w3g2000hsg.googlegrou ps.com...
On Jul 11, 7:45 pm, "Steve" <S...@community.nospam.comwrote:
>the stored procedure is actually a select statement that calls a view
which
is doing a select, joins, etc on tables.
but the stored procedure is

select * from vGetUserInformation where ID = @id

and the view is doing all of the work

Well, then it's something the code I guess... Need to see it :-)

Jul 11 '07 #5

P: n/a
On Jul 11, 8:20 pm, "Steve" <S...@community.nospam.comwrote:
need to see what? the .net code or the SQL code?
Steve, you said that
issue I'm running into is that only the data for the last username passed to
the stored procedure is being passed back
So I think that the problem is somewhere either in the .net code which
runs the stored procedure, or in the stored procedure itself. If you
think that the stored procedure is ok then we should check the code
which calls the stored procedure. Maybe you call it only once, or
something like this... ??

Jul 11 '07 #6

P: n/a
i have something like

string userList = txtUsername.txt;
string[] user= userList.split(',');

foreach(String u in users)
{
DataSet dsUsers = new DataSet();
dsUsers = GetUserDetails(u);
}

//this calls the datalayer which houses the stored procedure
Public DataSet GetUserDetals(string userName)
{
DataSet ds = new DataSet();
ds = UserInformation.UserDetails(userName);
return ds;
}
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@r34g2000hsd.googlegr oups.com...
On Jul 11, 8:20 pm, "Steve" <S...@community.nospam.comwrote:
>need to see what? the .net code or the SQL code?

Steve, you said that
>issue I'm running into is that only the data for the last username passed
to
the stored procedure is being passed back

So I think that the problem is somewhere either in the .net code which
runs the stored procedure, or in the stored procedure itself. If you
think that the stored procedure is ok then we should check the code
which calls the stored procedure. Maybe you call it only once, or
something like this... ??

Jul 11 '07 #7

P: n/a
On Jul 11, 8:58 pm, "Steve" <S...@community.nospam.comwrote:
i have something like

string userList = txtUsername.txt;
string[] user= userList.split(',');

foreach(String u in users)
{
DataSet dsUsers = new DataSet();
dsUsers = GetUserDetails(u);

}
What do you do with dsUsers after that?

Jul 11 '07 #8

P: n/a
I'm reading through it to see if the users in the textbox are in the
returned dataset from my stored procedure
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@r34g2000hsd.googlegr oups.com...
On Jul 11, 8:58 pm, "Steve" <S...@community.nospam.comwrote:
>i have something like

string userList = txtUsername.txt;
string[] user= userList.split(',');

foreach(String u in users)
{
DataSet dsUsers = new DataSet();
dsUsers = GetUserDetails(u);

}

What do you do with dsUsers after that?

Jul 11 '07 #9

P: n/a
On Jul 11, 9:34 pm, "Steve" <S...@community.nospam.comwrote:
I'm reading through it to see if the users in the textbox are in the
returned dataset from my stored procedure"Alexey Smirnov" <alexey.smir...@gmail.comwrote in message
Okay, let's test it...

You have JSmith, SLong, SHenry in the txtUsername

So

string userList = txtUsername.txt;
string[] user= userList.split(',');

foreach(String u in users)
{
// user #1: JSmith

DataSet dsUsers = new DataSet();
dsUsers = GetUserDetails(u); // u = JSmith

// and now, what do you do with the data?
}

If database has that JSmith in the vGetUserInformation table, then you
should get some data from it

select * from vGetUserInformation where ID = @id // @id = 'JSmith'

if dsUsers is not empty than the error somewhere in the .net code
after the one you sent above.

Jul 11 '07 #10

P: n/a
On Jul 11, 10:29 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Jul 11, 9:34 pm, "Steve" <S...@community.nospam.comwrote:
I'm reading through it to see if the users in the textbox are in the
returned dataset from my stored procedure"Alexey Smirnov" <alexey.smir...@gmail.comwrote in message
P.S.

string[] user= userList.split(',');

returns

'JSmith'
' SLong' <-- with the leading space
' SHenry' <-- with the leading space

could be a problem, if you don't trim()

Jul 11 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.