Hi ,
I am trying to write a report generator by simply using a form and then a gridview that query's the database based on what the user selects on the form. Anyways, I update the SQL parameters similar to below code. I just want to know how i can tell the parameter to get ALL values from the parameter instead of a specific value. For example if the user wanted to see ALL the records for CustomerName what would i set the parameter default value to? I tried the asterisk but that did not work. Please guide me....Thanks! Matt
SqlDataSource1.SelectParameters["CustomerName"].DefaultValue = "some value";
<asp:SqlDataSource ... >
<SelectParameters>
<asp:Parameter Name="CustomerName" />
</SelectParameters>
</asp:SqlDataSource>
Column1 in table 1 has a range from 1 to 5 (int) A CheckboxList displays these 5 items. When checked (for example 1 and 4) I want a gridview with sqldatasource=sqlProducts to display the records where column1 values 1 or 4. When I use the code below I only get the records where column1 values 1.... <asp:SQLDataSource id="sqlProducts" Runat="Server" SelectCommand="Select * From Table1 where Column1 IN (@CBLchecked_items)" ConnectionString="<%$ ConnectionStrings:pubs %>"> <SelectParameters> <asp:ControlParameter Name="CBLchecked_items" ControlID="CBL" propertyname="SelectedValue" type="String" /> </SelectParameters></asp:SQLDataSource>
I'm trying to use WSS3 & RS 2005 as Integration Mode. But i cannot create a data source item on sharepoint site library.
If i go to Central Administration > Configure Reporting Services Integration,
I can see the settings, thats mean that the Report Server is available ( i think so ) And also i can create dataources on Central Administration Web site (//servername:12500)
But from my production server web site ( //servername/ ), i cannot create those items.
I received the message
An unexpected error occurred while connecting to the report server. Verify that the report server is available and configured for SharePoint integrated mode.
Can somebody help me to fix that strange behavior.
Hi: I'm try to create a stored procedure where I sum the amounts in an invoice and then store that summed amount in the Invoice record. My attempts at this have been me with the error "The multi-part identifier "items.TAX" could not be bound"Any help at correcting my procedure would be greatly appreciate. Regards,Roger Swetnam ALTER PROCEDURE [dbo].[UpdateInvoiceSummary] @Invoice_ID intAS DECLARE @Amount intBEGIN SELECT Invoice_ID, SUM(Rate * Quantity) AS Amount, SUM(PST) AS TAX FROM InvoiceItems AS items GROUP BY Invoice_ID HAVING (Invoice_ID = @Invoice_ID) Update Invoices SET Amount = items.Amount WHERE Invoice_ID =@Invoice_IDEND
I am struggling to come up with a set-based solution for this problem (i.e. that doesn't involve loops/cursors) ..A table contains items (identified by an ItemCode) and the set they belong to (identified by a SetId). Here is some sample data:
SetIdItemCode 1A 1B 24 28 26 310 312 410
[code]....
You can see that there are some sets that have the same members:
- 1 and 10 - 2 and 11 - 7, 8 & 9
What I want to do is identify the sets that have the same members, by giving them the same ID in another column called UniqueSetId.
I'm having an issue creating a report that can group & sum similar items together (I know in some ways, the requirement doesn't make sense, but it's what the client wants).
I have a table of items (i.e. products). In some cases, items can be components of another item (called "Kits"). In this scenario, we consider the kit itself, the "parent item" and the components within the kit are called "child items". In our Items table, we have a field called "Parent_Item_Id". Records for Child Items contain the Item Id of the parent. So a sample of my database would be the following:
Item's 2 & 3 are child items of "Kit A", Item 5 is a child item of "Kit B" and Item 6 is just a stand alone item.
So, in my report, the client wants to see the SUM of both the kit & its components in a single line, grouped by the parent item. So an example of the report would be the following:
Name | Available Qty -------------------------- Kit A | 15 Kit B | 25 Item 4 | 100
Hi there!Basicly I only want to retrieve the value of the field "FirstTime" from a record as shown below:1 2 Dim ProdUserID As String = "samurai" 3 4 Dim LoginSource As New SqlDataSource() 5 6 LoginSource.ConnectionString = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString1").ToString() 7 8 LoginSource.SelectCommandType = SqlDataSourceCommandType.Text 9 LoginSource.SelectCommand = "SELECT FROM aspnet_Users (FirstTime) VALUES (@FirstTime) WHERE UserName=@ProdUserID" 10 11 Dim SeExiste As Boolean = LoginSource.SelectParameters.GetValues("@FirstTime") 12 This is the error reported:Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30455: Argument not specified for parameter 'control' of 'Public Function GetValues(context As System.Web.HttpContext, control As System.Web.UI.Control) As System.Collections.Specialized.IOrderedDictionary'. Please can you answer in the same logical schema? I'm a newbie so if you may, describe the process step by step. It would be easier for me to understand.Thanks in advance.
What am I forgetting to do? I am setting the SELECT parameter 'techcode' in the code behind trying to paqss it as the ZWOP in my SQL Select statement but it is not getting to the SQl SelectParameters statement. Do I need to place a TextBox control on the ASPX page to hold it? ERROR: Exception Details: System.InvalidOperationException: Could not find control 'techcode' in ControlParameter 'ZWOP'. CODE BEHINDint techcode;protected void Page_Load(object sender, EventArgs e){ techcode = 11; } ASPX CODE. . . SelectCommand="SELECT [ZL_ID], [complete], [error], [Zip], [ZipCity], [ZipState], [ZWOP] FROM ZipData WHERE ([complete] = 0 OR [complete] IS NULL ) AND [ZWOP] = @techcode ORDER BY Zip" <SelectParameters> <asp:ControlParameter ControlID="techcode" Name="ZWOP" PropertyName="SelectedValue" Type="Int16" /> </SelectParameters>
What im looking to do is put a checkbox on my page and if the box is checked have it add a where clause to the sql statement. The most i have seen with selectparameters is for it to basically take the value of the given control (or whatever) and dump it in to a query. In this case what i would like to do is if the box is not checked it has my basic query run Select * from Table and if the box is checked i would like it to run Select * from table where status='completed' basically a check box that shows only completed items. wasnt sure if i could do this with just the sqldatasource control and some selectparameters or if i had to write some code. Thanks Justin
Hi, I am using Visual Web Developer 2005 Express Edition. I am trying to SELECT three information fields from a table when the Page_Load take place (so I select the info on the fly). The refering page, sends the spesific record id as "Articleid", that looks typically like this: "http://localhost:1424/BelaBela/accom_Contents.aspx?Articleid=2". I need to extract the "Article=2" so that I can access record 2 (in this example). How do I define the SelectParameters or QueryStingField on the fly so that I can define the WHERE part of my query (see code below). If I remove the WHERE portion, then it works, but it seem to return the very last record in the database, and if I include it, then I get an error "Must declare the scalar variable @resortid". How do I programatically set it up so that @resortid contains the value that is associated with "Articleid"? My code is below. Thank you for your advise! RegardsJan/******************************************************************************* * RETRIEVE INFORMATION FROM DATABASE *******************************************************************************/ // specify the data source string connContStr = ConfigurationManager.ConnectionStrings["tourism_connect1"].ConnectionString; SqlConnection myConn = new SqlConnection(connContStr);
// define the command query String query = "SELECT resortid, TourismGrading, resortHits FROM Resorts WHERE ([resortid] = @resortid)"; SqlCommand myCommand = new SqlCommand(query, myConn);
// open the connection and instantiate a datareader myConn.Open(); SqlDataReader myReader = myCommand.ExecuteReader();
// loop thru the reader while (myReader.Read()) { Label5.Text = myReader.GetInt32(0).ToString(); Label6.Text = myReader.GetInt32(1).ToString(); Label7.Text = myReader.GetInt32(2).ToString(); }
// close the reader and the connection myReader.Close(); myConn.Close();
Hello, I am sure there is a way to do this programmatically, but it is just not sinking in yet on how to go about this. I have a page where I use a dropdownlist that goes into a gridview and then the selected item of the gridview into the detailsview (typical explain seen online). So, when selecting from the dropdownlist, the gridview uses a controlparameter for the selectparameter to display the appropriate data in the gridview (and so on for the detailslist). My question is - I wanted to use this same page when coming in from a different page that would utilize querystring. So, the parameter in the querystring would be for what to filter on in the gridview, so the dropdownlist (and that associated controlparameter) should be ignored. Any suggestions on how to go about this? I assume there is some check of some sort I should in the code (like if querystring is present, use this querystringparameter, else use the controlparameter), but I am not sure exactly what I should check for and how to set up these parameters programmatically. Thanks, Jennifer
Hi, I am using a grid view with parameter defined in dropdown list. the asp code is: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Pubs %>" SelectCommand="SELECT [au_id], [au_lname], [au_fname], [state] FROM [authors] WHERE ([state] = @state)" DeleteCommand="DELETE FROM [authors] WHERE [au_id] = @au_id"> <SelectParameters> <asp:ControlParameter ControlID="DropDownList1" Name="state" PropertyName="SelectedValue" Type="String" /></SelectParameters> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Pubs %>" SelectCommand="SELECT [au_id], [au_lname], [au_fname], [state] FROM [authors] WHERE ([state] = @state)" DeleteCommand="DELETE FROM [authors] WHERE [au_id] = @au_id"> <SelectParameters> <asp:ControlParameter ControlID="DropDownList1" Name="state" PropertyName="SelectedValue" Type="String" /> </SelectParameters> </asp:SqlDataSource> </asp:SqlDataSource> I would like to to set the parameter assignment in my VB code in Page_Load methodWhen i am using: SqlDataSource1.SelectParameters("state").DefaultValue = DropDownList1.Text SqlDataSource1.SelectCommand = "SELECT [au_id], [au_lname], [au_fname], [state] FROM [authors] WHERE ([state] = @state)"I get error message saying: Object reference not set to an instance of an object. Any ideas how I can set the select parameters (in my VB code) to use the dropdown list I have in my page? Thanks, Uzi
Hi All, I'm trying to set the SelectParameters of SqlDataSource from the code behind. This is my query: SELECT * FROM [UploadSessions] WHERE ([OwnerID] = @OwnerID)And I need to set the value of the @OwnerID at the code behind since it is stored in an object. How can I do it?? Thanks in advance Bar
Hi,I have a GridView which is bound to a SqlDataSource that connects to Oracle. Here's the code: <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:OracleConnectionString %>" ProviderName="<%$ ConnectionStrings:OracleConnectionString.ProviderName %>" SelectCommand="SELECT QUIZ.TITLE FROM QUIZ WHERE (QUIZ.USERNAME = @UserName)"> <SelectParameters> <asp:SessionParameter Name="UserName" SessionField="currentUser" Type="String" /> </SelectParameters> </asp:SqlDataSource> As you can see I'm trying to pass the value of the "currentUser" session variable to the query. I get an error message "ORA-xxx Illegal name/variable". Where am I going wrong? I tested the connection by placing a specific value instead of the "@UserName" and it worked.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CollegeDatabaseConnectionString %>" SelectCommand="SELECT employee_datails.* FROM employee_datails WHERE memberid !=@id OR memberid OR memberid==uid"> <SelectParameters> <asp:SessionParameter Name="id" SessionField="userid" /> <asp:QueryStringParameter Name="uid" QueryStringField="memberid" /> </SelectParameters> </asp:SqlDataSource> I tried like this but it is not working. It takes at a time one sessionparameter or querystringparameter. I want if profile.aspx--> then i want session parameter in select queryIf profile.aspx?id=12432---> then i want querystringparameter in select query.
How to pass a null to SelectParameters in SqlDataSource? The type of "CreateDate" is DateTime, the following code can be run correctly! SqlDataSource1.SelectParameters["CreateDate"].ConvertEmptyStringToNull = true;SqlDataSource1.SelectParameters["CreateDate"].DefaultValue = "2006-11-12"; now I hope to pass null value to the Parameter "CreateDate", but the following 3 section codes don't work! SqlDataSource1.SelectParameters["CreateDate"].ConvertEmptyStringToNull = true;SqlDataSource1.SelectParameters["CreateDate"].DefaultValue = string.Empty; or SqlDataSource1.SelectParameters["CreateDate"].ConvertEmptyStringToNull = true;SqlDataSource1.SelectParameters["CreateDate"].DefaultValue =null; or SqlDataSource1.SelectParameters["CreateDate"].ConvertEmptyStringToNull = true;SqlDataSource1.SelectParameters["CreateDate"].DefaultValue = "";
I Have This StoredProcedure ALTER PROCEDURE dbo.Default_Edit1 ( @ID int, @Family Nvarchar (100) OutPut ) AS SELECT @Family=Family FROM Table1 where (ID=@ID) RETURN I went to use SqlDataSource1.SelectParameters to Return Data Ho to get and set @ID , @Family with SelectParameters ?
I have a simple gridview that loads on page load. It uses an on page sqldatasource declaration in which there's a parameter in which value is already available in cookies. I added an asp:HiddenField and set that value on PageLoad() to the value of the cookies. I then set a FormParameter in the sqldatasource mapped to that hidden field. However that appears to have no effect at all. I'm guessing the sqldatasource will only use the form field after postback.
Hi everyone, I am building a search page and am a bit stuck. The page has an sqldatasource with no select command and i am passing the select command and parameters depending on the optionsm selected. If a tick box is ticked and a drop down selected i need to add a parameter to the datasource and generate the select command. then if 1 and or 2 trext boxes are filled in, add the 1 or 2 select parameters then generate the select command. The select command is correct as far as i can tell , but the parameters are not being passed to the datasource so it doesn't select anything. my code behind is in the page load handler and at the moment only adds the parameters in one place so i could test. Does anyone have any idea what i have done wrong?
Cheers Chris CODE BEHINDProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim SQLstr As String
If cb_Today.Checked = True And dd_Area.SelectedValue.ToString <> "" ThenLocManSearch.SelectParameters.Add("Area", TypeCode.String, dd_Area.SelectedValue.ToString()) SQLstr = "SELECT * FROM [LocMan_CV] WHERE ([area] LIKE '%" & dd_Area.SelectedValue.ToString() & "%') AND ([available] LIKE '%" & Date.Today & "%') AND ([viewable] = 'True')" ElseIf cb_Today.Checked = False And dd_Area.SelectedValue.ToString <> "" Then SQLstr = "SELECT * FROM [LocMan_CV] WHERE ([area] LIKE '%" & dd_Area.SelectedValue.ToString() & "%') " ElseIf txt_FName.Text <> "" And txt_LName.Text <> "" And cb_Today.Checked = False And dd_Area.SelectedValue.ToString = "" Then SQLstr = "SELECT * FROM [LocMan_CV] WHERE ([FirstName] LIKE '%" & txt_FName.Text.ToString() & "%') and [LastName] LIKE '%" & txt_LName.Text.ToString() & "%')" ElseIf txt_LName.Text <> "" And cb_Today.Checked = False And dd_Area.SelectedValue.ToString = "" Then SQLstr = "SELECT * FROM [LocMan_CV] WHERE ([LastName] LIKE '%" & txt_LName.Text.ToString() & "%')" ElseIf txt_FName.Text <> "" And cb_Today.Checked = False And dd_Area.SelectedValue.ToString = "" Then SQLstr = "SELECT * FROM [LocMan_CV] WHERE ([FirstName] LIKE '%" & txt_FName.Text.ToString() & "%')" End If Response.Write(SQLstr) LocManSearch.SelectCommand = SQLstr End Sub
Hello to all coding members! I'm building my first ever complete website in the ASP.net VB language and I have to say, I'm pretty happy that I was able to learn from this website and to gain some ground. Data retrieval and editing from tables and databases was very intuitive with the Visual Web Developer IDE. I even learnt simple ways to implement (and to script a bit of) login pages to make my visitors feel "at home" in my website.However, when I wanted to implement simple Business Logic into one of my ASP.net page, i happen to stumble upon a block.Business Logic: To have the server go through the whole table of storybook entries submitted by many users, but only pull out the storybook entry(s) that belong to the logged-on user.Hence, let me drill down to my specific questions:
I will be using VB. Coming from a JavaScript genre, my concern is: will putting the Business Logic code into a code-behind page (.vb) or dumping it onto the page itself have any errors or effects?
Hi everybody, I am having trouble how to fixed this code. I am trying to supply the parameterinside a stored procedure with a value, and displays error message shown below. If I did not supply the parameter with a value, it works. How to fix this?Error Message:Procedure or function <stored proc name> has too many arguments specified.Thanks,den2005 Stored procedure:
Alter PROCEDURE [dbo].[sp_GetIdeaByCategory] @CatId <span class="kwd">int</span> = 0 AS BEGIN SET NOCOUNT ON;
Select I.*, C.*, U.* From Idea I inner join IdeaCategory C on I.CategoryID = C.IdeaCategoryID inner join Users U on I.UserID = U.UserID Where I.CategoryID = @CatId Order By LastModifiedDate Desc End
I'm trying to include the COUNT(*) value of a sub-query in the results of a parent query. My SQL code is:
SELECT appt.ref, (Case When noteCount > 0 Then 1 Else 0 End) AS notes FROM touchAppointments appt, (SELECT COUNT(*) as noteCount FROM touchNotes WHERE appointment=touchAppointments.ref) note WHERE appt.practitioner=1
This comes up with an error basically saying that 'touchAppointments' isn't valid in the subquery. How can I get this statement to work and return the number of notes that relate to the relevant appointment?
I'm working on a document management system that will allow the users to tag docs. Would it better in terms of performance and general maintenance to have all the tags comma de-limited in a column of the doc record, or have each tag in a row of an associated table?
Hello Experts. You may have more luck at this than me.
I am interested in finding the quantity of items that were ordered alone. I have an orderid field and a product field. So the count of the orderid has to equal one and the have them grouped by product.
Example of how data looks like
I am looking for transactions like orderid 3 and 5.
I working on a form using an SQL DataSource. I am going to add a where clause. In that where clause a value from a label will be passed from the user. How do I pass to the HTML Source the label value from the where clause. The value can change from user to user. Sample below: SELECT [KeyRolesID], [KeyRolesDesc] FROM [KeyRoles] WHERE ([JobCodeFamily] = @JobCodeFamily). I want to replace the @JobCodeFamily which is currently coded with a value from the Sql DataSource in the design form with a label value entered by the user.
but it doesn't work, I tried use a pure asp.net web service and it works. can anyone help me to set the connecting string for datasource and query for dataset when it using wcf as the web service? Thanks in advance.
I have a question about the datasource that we create on the Report Manager. What is it used for? In the below connection string which is given in the "Connection String" text box of a datasource link:
What is this datasource used for? Is it used only to use the ReportServer database or even our queries incorporated in the RDL files will be run against this datasource? I think the latter should not happen because while creating RDL files also, we provide a connection string to run the stored procedures against that datasource.
Please let me know about the same.
Thanks a lot and let me know if the question is not clear.
I need to create a stored procedure that takes a list of product numbers(541, 456, CE6050,...) and selects only the customers that have all product numbers in the list. I have a product table that has the following schema:
So a customer can have more than one product, but I need a select statement that takes the product numbers and selects them against the product table and returns only the customerNumbers that have the entire list of product numbers. I have tried doing a join on the product list and productNumber, then join with the customer table on customerNumber, but that gets any entires found in the list not the entries that have all the product numbers. Thanks in advance for any help.