DataSource Controls :: Return User And A Set Of Values From The Same Sprocedure?

Oct 11, 2010

I have a user table with userID, userName ...the standards. I also have a "Material" table with materialID, materialName, etc.

I combine these in another table "UsersMaterial" with userID and materialID, depending on which materials the user has chosen (between 0 and 5).

Now I need a stored procedure that returns the user information + the set of materials that is mapped to the user.

But I can't see how I can return one row of user information combined with a set of the user materials? Do I join or can I return a set + one row?

View 1 Replies


Similar Messages:

DataSource Controls :: Return Values From Select Statement?

Feb 8, 2011

I have a select statement in a stored procedure and want to be able to retrieve the key column value (PRODUCTID)and return it as Output when Select statement is executed on input Parameter (NAME).

addition, return two further output values (COST,TOTAL).

note the grid control expects to receive all values at once! so i need to get out these values at the same instance of execution.

Select productID,COST,QUANTITY,NAME,TOTAL,DATE
FROM PRODUCTS
WHERE NAME=@NAME

View 2 Replies

DataSource Controls :: How To Get Query To Return Values From Xml Column In Table

Jun 24, 2010

I am trying to do a lookup in a table with a value stored in an xml column.

I tried this several ways but I can't get it to work.

Here is some code:

[Code]....

View 1 Replies

DataSource Controls :: Return Multiple Values From Stored Procedure?

Jun 2, 2010

Is it possible to return multiple values from a stored procedure? Basically, if I execute the stored proc on the C# side, then on the SQL side I do multiple calculations. Let's say I have 5 int values I need returned to the C# side.

View 4 Replies

DataSource Controls :: StronglyTypedDataset - Assign User Input Values To The Columns Of  StronglyTypedDataset?

Jan 25, 2010

I have successfully created a strongly typed dataset. And trying to assign my user input values to the columns of my StronglyTypedDataset but having no luck with it

[Code]....

In the above code 'PlantInventoryAccuracy' is the name of the Strongly Typed Dataset and 'PlantInventoryAccuracyDataTable' is the dataTable. when I try o debug this to see if my user input values are being assigned to te currentRow I see blue squuiggly line under the 'new' key word when I mouse hover it says

'The type PlantInventoryAccuracy.PlantInventoryAccuracyRow has no constructors defined.'

This is the first time I am trying to use Storngly typed datasets. I am not sure if I am trying to use it right. The above code is in my code behind page and my idea is to fill this row with the user input values then pass this to my data layer where I need to assign these values as the parameters to the stored procedure I have created and then store them to the database.

View 3 Replies

Forms Data Controls :: Get The Return Values After Inserting / Updating?

Jun 8, 2010

I am using Stored Procedure as my Insert/Update command in a FormView. The sp returns a value which I will need to use. How do I retrieve the value after doing an insert / update?

View 4 Replies

Forms Data Controls :: Gridview - Won't Return Anything At All Unless Provide Values For All 4 Parameters

Feb 25, 2011

i've got a gridview and sql datasource. Its connected to a stored proc that has four optional parameters. In VS when i set up the data source, if i use the test option, and dont supply any values for the sproc, it returns all the values in the table which is what it should do. Now when i try to fill the gridview, it wont return anything at all unless i provide values for all 4 parameters.

It's not even trying to search because i had sql profiler open and nothing shows up until i provide all 4 values. any idea why it's doing this? How do i get it to actually bind even if provide less then all 4 (or none) of the values?

View 1 Replies

Forms Data Controls :: GridView - Remember Values On Page Return?

Jan 25, 2010

I have a multiple page gridview and edit link on each row.

View 8 Replies

Forms Data Controls :: Grid View Is Unable To Return The Values That Are Present In

Mar 28, 2010

I have a grid view and I added edit and Save buttons to it. When I click on edit I am able to edit the data but when I click on save I amgetting the data before edit.

Please see my code below.

Eg: I have start date as 2005-10-10 12:00 AM so After I click On edit it is letting me to edit, So If I edit the start date to 2010-10-10 12:00 PM and click on the save button I am stil getting the old start date. which is 2005-10-10 12:00 AM instead of 2010-10-10 12:00 PM

<asp:GridView ID="gvPosHistory" runat="server" AutoGenerateColumns="False" AllowPaging="True"
AllowSorting="true" Width="650px" PageSize="20" CssClass="Gridview" Visible="false"

OnRowCommand="gvPosHistory_RowCommand"
OnRowDataBound="gvPosHistory_RowDataBound"
OnRowEditing="gvPosHistory_RowEditing"
OnRowUpdating="gvPosHistory_RowUpdating"
onrowcancelingedit="gvPosHistory_RowCancelingEdit" >
<Columns>
<asp:TemplateField HeaderText="Start Date" SortExpression="startDate">
<HeaderStyle Wrap="False" Font-Bold="True" HorizontalAlign="Center"
VerticalAlign="Top" />
<ItemStyle Wrap="False" HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="lblstartdate" runat="server" text='<%# Eval("StartDate")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate >
<asp:TextBox ID="txtStartDate" runat="server" Text='<%# Bind("StartDate")%>' ></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="End Date" SortExpression="endDate">
<HeaderStyle Wrap="False" Font-Bold="True" HorizontalAlign="Center"
VerticalAlign="Top" />
<ItemStyle Wrap="False" HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="lblenddate" runat="server" text='<%# Eval("EndDate")%>' ></asp:Label>
</ItemTemplate>
<EditItemTemplate >
<asp:TextBox ID="txtEndDate" runat="server" Text='<%# Bind("EndDate")%>' ></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Functional Job Title" SortExpression="JobTitle">
<HeaderStyle Wrap="False" Font-Bold="True" HorizontalAlign="Center"
VerticalAlign="Top" />
<ItemStyle Wrap="False" HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="lblFunctjobTitle" runat="server" text='<%# Eval("FunctionalJobTitle")%>' ></asp:Label>
</ItemTemplate>
<EditItemTemplate >
<asp:TextBox ID="txtFuncJobTitle" runat="server" text='<%# Bind("FunctionalJobTitle")%>' ></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Department" SortExpression="Department">
<HeaderStyle Wrap="False" Font-Bold="True" HorizontalAlign="Center"
VerticalAlign="Top" />
<ItemStyle Wrap="False" HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="lblDepartment" runat="server" text='<%# Eval("DeptName")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate >
<asp:TextBox ID="txtDeptName" runat="server" Text='<%# Bind("DeptName")%>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Supervisor" SortExpression="Supervisor">
<HeaderStyle Wrap="False" Font-Bold="True" HorizontalAlign="Center"
VerticalAlign="Top" />
<ItemStyle Wrap="False" HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="lblSupervisor" runat="server" text='<%# Eval("Supervisor")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate >
<asp:TextBox ID="txtSupervisor" runat="server" Text='<%# Bind("Supervisor")%>' ></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Bargaining Unit" SortExpression="bargainingunit">
<HeaderStyle Wrap="False" Font-Bold="True" HorizontalAlign="Center"
VerticalAlign="Top" />
<ItemStyle Wrap="False" HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="lblbargainingunit" runat="server" text='<%# Eval("BargainingUnit")%>' ></asp:Label>
</ItemTemplate>
<EditItemTemplate >
<asp:TextBox ID="txtBargainingUnit" runat="server" text='<%# Bind("BargainingUnit")%>' ></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="UCP Level" SortExpression="UCPlevel">
<HeaderStyle Wrap="False" Font-Bold="True" HorizontalAlign="Center"
VerticalAlign="Top" />
<ItemStyle Wrap="False" HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="lblUCPlevel" runat="server" text='<%# Eval("UCPLevel")%>' ></asp:Label>
</ItemTemplate>
<EditItemTemplate >
<asp:TextBox ID="txtUcpLevel" runat="server" Text='<%#Bind("UCPLevel")%>' ></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit" SortExpression="Edit">
<HeaderStyle Wrap="False" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Top" />
<ItemStyle Wrap="True" HorizontalAlign="Left" />
<ItemTemplate>
<asp:LinkButton ID="LBPosHistoryEdit" Text="Edit" runat="server" CommandName="Edit" ></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Save" SortExpression="Save">
<HeaderStyle Wrap="False" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Top" />
<ItemStyle Wrap="True" HorizontalAlign="Left" />
<EditItemTemplate>
<asp:LinkButton ID="LBPosHistorySave" Text="Save" runat="server" CommandName="SavePosHistory" CommandArgument='<%# Eval("UCPLevel")%>' ></asp:LinkButton>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
.aspx.cs
protected void gvPosHistory_RowCommand(object source, GridViewCommandEventArgs e)
{
if (e.CommandName == "SavePosHistory")
{
string arg = Convert.ToString(e.CommandArgument);
System.Web.UI.WebControls.LinkButton btnPosHistory = e.CommandSource as System.Web.UI.WebControls.LinkButton;
GridViewRow row = btnPosHistory.NamingContainer as GridViewRow;
TextBox tSdate = row.FindControl("txtStartDate") as TextBox;
TextBox tEdate = row.FindControl("txtEndDate") as TextBox;
TextBox tFuncJobTitle = row.FindControl("txtFuncJobTitle") as TextBox;
TextBox tDeptName = row.FindControl("txtDeptName") as TextBox;
TextBox tSupervisor = row.FindControl("txtSupervisor") as TextBox;
TextBox tBargainingUnit = row.FindControl("txtBargainingUnit") as TextBox;
TextBox tUCPLevel = row.FindControl("txtUcpLevel") as TextBox;
}
}

View 1 Replies

DataSource Controls :: Why Does Cmd.ExecuteNonQuery() Return -1

Mar 3, 2010

I have created a stored procedure that reset my tables' identity value. The store procedure works fine when I didrectly run it in my ms sql server 2008. It reset my table Identity value However, when I call it from my function reset, it returns -1, and does not reset my table identitity value. The function to restet my identity value is:

[Code]....

My stored procedure is

[Code]....

To call the the function:

Dim result
As
Integer = util.resetTableIdentity("myTable", "id", 60)
util.print(result)

I got result is -1, and it does ot reset my table identity. Why? How to resove it?

View 4 Replies

DataSource Controls :: Return Value From Sql In GridView?

Aug 28, 2010

I have textbox for searching a Names in My database. I return the information from the Select Statement in GridView, but i want to know the number of affected rows. How to do that?

View 3 Replies

C# - How To Return Number Of Members From User Controls In 3.5

Feb 15, 2011

Which class member can I use to return the number of members, that have signed up for an account? (I'm using the built-in membership/profile/log-in stuff..)

View 1 Replies

DataSource Controls :: How To Return A Single Row Where There Is A One To Many Relationship

Jun 23, 2010

I have 2 tables. Table_A has one to many relationship with Table_B.

For example. Table_A has an ApplicantKey and in Table_B I am storing (Resume_name and CoverLetter_name for the Applicant). Joined by ApplicantKey

Now when I join them and execute the query obviously it returns me two rows. But what I want is that it should return only one row with Columns like Resume_name, CoverLetter_Name

View 2 Replies

DataSource Controls :: How To Access The Return Value Of The SQLDataReade

Feb 15, 2010

accessing the return value of the SQLDataReader. My code is below. Actually the variable that I assigned my SQLDatareader object to is say HasRows property=true. But I am having trouble accessing the return value. And I get the error when I use the following code .Text =SQLDataReader("Contact Name").ToString I get the following error message: Invalid attempt to read when no data is present.

con = New SqlConnection(ConfigurationManager.ConnectionStrings("Connect").ConnectionString)
Dim getDirectorsCMD As SqlCommand = New SqlCommand("dbo.spGetDirector", con)
getDirectorsCMD.CommandType = CommandType.StoredProcedure
Dim myParm As SqlParameter = getDirectorsCMD.Parameters.Add("@BuildingTID", SqlDbType.Int, 15)
myParm.Value = ddlBuilding.SelectedValue
[code]...

View 3 Replies

DataSource Controls :: Return ID Of Inserted Record

Jan 12, 2010

I followed this BRILLIANT article and found out how to make a data layer, i just need the insert method in this code to return the ID of the record inserted.

For example, when the user captures the details, the save button is clicked, i will want to display in a label "Your Reference Number is "

try and have look at the article so you will understand how the code is, so it will not be hard to edit my code.

[URL]

View 7 Replies

DataSource Controls :: Return Range Of Dates

Feb 25, 2010

I have this query:

[Code]....

I want to select dates that also fallin the range. Heres the scenario: I have an event from 01/20/2010 TO 01/25/2010. So right now it would only return a date of 01/20/2010. How could I return 01/20/2010, 01/21/2010 , 01/22/2010, 01/23/2010, 01/24/2010, 01/25/2010? Mind you only a start and end date are in the database.

View 3 Replies

DataSource Controls :: Return New ID From LINQ InsertOnSubmit?

Jan 21, 2010

I have an autoincrement ID on some table.I need to know what is the ID of the new row when I add the object using InsertOnSubmit, but this method returns void.What is the common way of doing this.

View 1 Replies

DataSource Controls :: Return First Value From A Linq Query?

Mar 12, 2010

Is there a way opf getting the first value from a linq query so for example

[Code]....

View 2 Replies

DataSource Controls :: Return String Value From The Function?

Mar 7, 2010

i try to return string value from the function i wrote for getting string value from the table for that i havecommon stored procedure

public string getdata(string str)
{
string datanew;

[code]...

View 2 Replies

DataSource Controls :: How To Retrieve The Return Value From Stored Procedure

Jun 16, 2010

i want to retrieve the return value of following stored procedure in my Data Access Layer of ASP

CREATE PROCEDURE Procedure_login

View 3 Replies

DataSource Controls :: SQL Statement - Don't Want To Return Duplicate Columns

Mar 11, 2010

I have the following simple stored procedure:

ALTER PROCEDURE GetadiByPhiNo

@PhiNo int

SELECT adirefno, adidescription

FROM aditable

WHERE adiphino = @PhiNo

Here is an example of data returned:

1 Skin diesease

2 Cough

3 Cough

4 Rash

You notice "Cough" is in the adidescription column twice. I would like to return only one row for adidescription with the same value. So what I want returned is this:

1 Skin diesease

2 Cough

4 Rash

View 8 Replies

DataSource Controls :: Return Value From Stored Procedure To C# Code Behind?

Mar 16, 2010

So I am getting this error message:

Cannot implicitly convert type 'System.Data.SqlClient.SqlParameter' to 'string' I have a stored procedure on SQL 2000 returning an email from a database table (aspnet_Membership). The email type from the table is nvarchar. I have a method (in C# in the code behind) that gets that value. But the debugger doesn't like the last line:

return returnEmail; // returnEmail is a string variable we created to capture the stored procedure's return value

I've tried doing returnEmail.toString() in several places, but still get the same error message for the last line of code (returning the email).

This is the stored procedure:

View 3 Replies

DataSource Controls :: How To Return Variables From Stored Procedure

Feb 1, 2010

I have a stored procedure which returns a value to state if the userlogin is valid. but i want to return the data and store it in a data session as i will require the user details in the checkout page.

is it best to get individual parameters out of the stored procedure then assign the variables to a datatable which is then assigned to session Or how can i get all the details returned from the stored procedure for the table? not sure which would be the most effective solution?

View 9 Replies

DataSource Controls :: Return Unique Rows : T-SQL Query

Jun 11, 2010

I have an SQL database table like the following:

ID // Code // Shape

The ID is the integer identifier.

On one line the Code may be OX01 and shape Hexagon for example

Then the next line the code is still OX01 but the shape is Triangle.

What I want to do is be able to pull back data for every line that is equal to a unique Code column. in the above example OX01 Hexagon would be returned but not OX01 Triangle.

I've tried using SELECT DISTINCT but it brings back all records and doesn't filter them correctly.

I've considered having another column which could have Child/Parent data so that only the parent is returned but i'm sure there must be a better way of doing this.

View 2 Replies

DataSource Controls :: Can Capture Return Value From A SQL By Using SqlConnection SqlCommand

Apr 15, 2010

can capture return value from a SQL by using SqlConnection SqlCommand

[Code]....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved