How To Default Drop Down List To A Specific Value In Database
Oct 21, 2014
I have a drop down list that is populated by a stored procedure which has two int parameters (ID, STATUS). I need to default the drop down list to a value in the database that is associated to the ID & STATUS parameters.
The problem I am having is that it only works if the selected value is the first record on the drop down list. for any other records (outside the first record) from the drop down list i get "The 'SelectedIndex' and 'SelectedValue' attributes are mutually exclusive."
Here is the stored procedure I am using to populate the drop down list:
ALTER PROCEDURE [dbo].[usp_SelectName]
(
@pId Int,
@pStatus Int
)
AS
BEGIN
IF @pId = -1 --THIS VALUE IS USED AS DEFAULT (NOT POSTBACK)
[Code] ....
Here is the TABLE_NAMES that holds the data for the drop down list:
IN_ID IN_NAMESTATUS
6 New 0
4 Generic 0
3 Local 1
4 Storm 0
This is the TABLE_2 that holds the complete collected FORM data that has the selected record IN_ID from the TABLE_NAME:
ID STATUS IN_ID
111906
114406
114505
114606
114706
I was wondering if anyone may be familiar with a way to create a dropdown list that included a list of SQLServers. Basically I want to create a little application that lets a user point to an instance of sql server, similar to enterprise manager. I wanted to use C# and figured there may be some namespaces I could use that provide this functionality but was not sure. Thanks,
We are listing available SQL databases for selection in a VB list box, but need to be able to then elicit the tables in the database for another list. I am sure it is something simple, could someone help me out with this? Thanks!! Laura
hi all !i'm kind of new to MYSQL so am still learning basics.my question is how do you create a drop down list in a field in an SQLdatabase ?thanksbrino
ALTER TABLE tm_spn_equip_def ADD Customer_No int NOT NULL DEFAULT dbo.f_spn_GetCustomerNo() WITH VALUES
Now when I attempt to do this...
ALTER TABLE tm_spn_equip_def DROP COLUMN Customer_No
I get an error:
Msg 5074, Level 16, State 1, Line 1 The object 'DF__tm_spn_eq__Custo__019E3B86' is dependent on column 'Customer_No'. Msg 4922, Level 16, State 9, Line 1 ALTER TABLE DROP COLUMN Customer_No failed because one or more objects access this column.
In my drop down menus - which are populated by tables - we can only use the scroll bar OR type in the first letter to find the item - Is there a way to type in several letters to find something? (e.g. if I want to find clockwork - right now I could type in "C" to get to the C's - but if I tried typing "clo" it would end up at the beginning of the "O's" - Thanks
I am using SSRS 2005 SP2 and I need to allow my users to select the products they want in the report. I created a data set to get the list of the products and then used it in a multivalue parameter to generate a drop down list. My problem is that the list is too long (more than 2000 elements) and thus, it takes 10 sec to collapse the drop down list after tickinging the products.
Does anyone have an miraculous solution? Thanks in advance for your answers.
hi, please help me, i have a data driven site, i made a field that i call "Status"so this is how it should happens, there are three different gridviews in a single page, gridview1 filter is [status] = ok, gridview2 filter is [status] = fine, gridview3 filter is [status] = complete, so all gridview has its own <asp:hyperLinkField> at first the value of "Status" is ok, so it will appear in the gridview1, so when the user click on the <asp:HyperLinkField> of gridview1 it will go to a new page with a form view, this page has a button that when click will change the value of the status field to "fine", so that it will no longer appear to the gridview1 but it will now appear to gridview2 and same with the next <asp:HyperLinkField> click until it appears to the final gridview. so my question is how can i make the button that is capable of changing (update) the value my database field (status) to a specific value, that is not visible to the user thru codebehind or plain asp.net codes. please help me, if you need more info just reply.ThanksSALAMAT PO!
Hi,I found this SQL in the news group to drop indexs in a table. I need ascript that will drop all indexes in all user tables of a givendatabase:DECLARE @indexName NVARCHAR(128)DECLARE @dropIndexSql NVARCHAR(4000)DECLARE tableIndexes CURSOR FORSELECT name FROM sysindexesWHERE id = OBJECT_ID(N'F_BI_Registration_Tracking_Summary')AND indid 0AND indid < 255AND INDEXPROPERTY(id, name, 'IsStatistics') = 0OPEN tableIndexesFETCH NEXT FROM tableIndexes INTO @indexNameWHILE @@fetch_status = 0BEGINSET @dropIndexSql = N' DROP INDEXF_BI_Registration_Tracking_Summary.' + @indexNameEXEC sp_executesql @dropIndexSqlFETCH NEXT FROM tableIndexes INTO @indexNameENDCLOSE tableIndexesDEALLOCATE tableIndexesTIARob
I have a drop down list populated using sqldatasource1 it is populated with [item] However, I need it to be poplulated with the three fields below AND, I don't want duplicates. SELECT [Item], [Alias1], [Alias2] FROM [Authors]
I have been trying to populate my dropdown list with State names in the USA. The dropdown list populates fine, but when I hit the submit button I receive the following message:
Could not find stored procedure 'Maryland'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Could not find stored procedure 'Maryland'.
Source Error:
Line 81: Dim sqlCmd As SqlCommand = New SqlCommand(sqlText, sqlConn) Line 82: sqlCmd.Connection.Open() Line 83: dr = sqlCmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection) Line 84: Return dr Line 85: End Function
I am trying to make a dropdownlist with a date. Where should I define that I do want only the date, not the hour. So far it shows something like "14-02-2006 0:00:00" whereas I just want "14-02=2006". I tried "CAST(CONVERT (varchar(25); Ma_Fecha; 112) AS datetime)" in the SQL Statement but it doesnt seem to work.[CODE]Dim sSQL As String = " SELECT "sSQL = sSQL & " Ma_Date,sDate "sSQL = sSQL & " FROM vwMareaMain "Dim comm As New SqlCommand(sSQL, objConn)Dim dataAdapter As New SqlDataAdapter(comm)dataAdapter.Fill(objDS2, "vwDate")Me.cboDate.DataMember = "vwDate"Me.cboDate.DataValueField = "Ma_Date"Me.cboDate.DataSource = objDS2.Tables("vwDate").DefaultView[/CODE]
How do you create a drop down box on the report so the users can chose a value and conduct their search according to that value, See I have a SP that when the users enter a parameter they get the results according to that paramter, I would like for the choose one rather then type it up. Can anyone help please
we can generate drop-down list on the tables by writing sql query at "Access". I was wondering whether or not the same thing can be done for SQL Server?
I am using Visual Studio 2005 to create a report from a OLAP cube.
I am building a drop down list for user to select the desired branch. My mdx query as follow:
with member [Measures].[ParameterCaption] AS '[Company].[Branch].Currentmember.Member_Caption' member [Measures].[ParameterValue] AS '[Company].[Branch].Currentmember.Uniquename' select {[Measures].[ParameterCaption], [Measures].[ParameterValue]} on columns, {[Company].[Branch].ALLMEMBERS} on rows from [Profit And Loss]
I would like to add a blank row in the result set, such that I can consider that as selecting ALL Branch
In my datawarehouse fact table I have a column (revenue) that I want to populate based on the values of number of columns, for simplicity, say just 2 columns, 'productid' and 'affiliateid'.
I have a revenue lookup table, with those same 2 columns and the amount. So far so simple, but rather than have one row for every possible combination, I use 0 to mean default. For instance, all the affiliates have the same revenue value apart from a couple, so instead of 200 rows identical except for the affiliateid, I have one row with a '0' for the affiliateid and 4 rows with specific affiliateIDs where it differs from the default.
To update the values, I join to the revenues table twice, one for both columns matching, and once for the default. I.E.
UPDATE facttable SET revenue = ISNULL(rev1.revenue, ISNULL(rev2.revenue,0)) FROM facttable FT LEFT OUTER JOIN revenues rev1 ON FT.AffiliateID = rev1.AffilateID and FT.TypeID = rev1.TypeID LEFT OUTER JOIN revenues rev2 ON rev1.AffilateID = 0 and FT.TypeID = rev1.TypeID (In fact, this is over-simplified, because in fact there are 3 columns, so I have to have 8 joins like this).
This works very well, and cuts down the management of revenues significantly, there are a few 100 rows instead of the more than 100,000 there would be if I put every possible combination of values in its own row.
However, now there is a requirement to increase the granularity of the revenue allocation up to 5 columns, which makes 36 joins and there could well be more columns added later.
Has anyone come across a situation like this (and found a neater solution).
[dbo].[PortalUser]( [PortalUserID] [bigint] IDENTITY(1,1) NOT NULL,
...
[dbo].[Role]( [RoleID] [bigint] IDENTITY(1,1) NOT NULL, [Name] [nvarchar](250) NOT NULL, [IsActive] [bit] NOT NULL CONSTRAINT [DF_Roles_IsActive] DEFAULT ((1)) ...
[dbo].[PortalUserRole]( [PortalUserRoleID] [bigint] IDENTITY(1,1) NOT NULL, [PortalUserID] [bigint] NOT NULL, [RoleID] [bigint] NOT NULL, [IsActive] [bit] NOT NULL CONSTRAINT [DF_PortalUserRole_IsActive] DEFAULT ((1))
I'm asking to get a list of portalUsers that do not have a PortalUserRole records for the rolename I'm checking against. And don't ask me why the person who coded this is searching on rolename not ID. But this is how we're doing it for now.
Hi: I need to change a column's datatype from tinyint to int as follows: alter table tableName alter column column1 int
but with error <<'DF__LandMarks__color__6A50C1DA' is depending on it.>>
However, this old default is not part of the constraint. Thus, the only way is to delete it from sysobjects.
unfortunately, the following code I have to commented since they could only be executed line by line, not within a begin...end block. --exec master.dbo.sp_configure 'allow updates', 1 --reconfigure with override --delete from sysobjects -- where name = 'DF__LandMarks__color__6A50C1DA' -- and type = 'D' --exec master.dbo.sp_configure 'allow updates', 0 --reconfigure with override
I need to update 10 server around 2500 databases with this change. I have looked INFORMATION_SCHEMA related views, but not found default related, maybe I missed something.
I was trying to write an expression someting like this.
(CASE WHEN (GroupVar2 IN('CBank','DTC', 'EDirect')) THEN GroupVar2 ELSE 'InstLend' END) AS COALESCE(GroupVar2,'Total') AS GroupVar2
In GroupVar2 column, following values are available;
CBank DTC EDirect InstLend Inst-Load
I use this for a parameter in my report. I want to consider inst-Load as the same as InstLend. In drop down menu , I should see only InstLend. When I select it, I should get summation of InstLend and Inst-Load. Also I should see 'Total' as one of the available value. So when I select total it should give me summation of all of above.
I have the following tables in an SQL Server database.
Contact ======= NameID TitleID Name
JobTitle ======== TitleID Title
I'm trying to make a form to add entries to the Contact table that lets me associate a job title to a name by choosing it from a drop down list. I have been able to make it so I get a drop down list of TitleID but I need the Title field displayed. I haven't been able to do it. Does anyone have any tips on how to do this?
is this even possible in reporting services? I already deployed reports for our client using Reporting Services 2000, one of their complaints was that the dropdownlist of the reports contains a very long list of data, this list cannot be shorten since all data are required. Is there a way to let the users type in characters, not only one character to find the exact data they want. The data in the drop down list are needed because these data are parameters.
Are there any web based reporting tools which can provide this kind of requirement?
My main task is to create a login under a specific database.
For which I'm validating whether that login already exists or not I'm checking it in the syslogins table. I need to specifically check it is in my databse or not....for that what should I do...
I created a report with a school parameter for all our schools in SQL report. The school parameter gets it's value from a query. The report is generated based on the selection made by the user. If user choose school "A", report is generated for school "A" and if user choose school "B" report is generated for school "B".
I am using a centralized user id and password for all users. A report URL (report link) is sent to user to access the report. Currently, from the school parameter (school drop-down list) users from any school may/can choose report for other schools other than theirs schoos. The content of the report is sensitive and we do not want anyone to see anyone else report.
I want to create a user based security, so based on the user id for school "A", he/she will only be able to see school "A" report but nothing else.
I was trying to accomplish this by creating linked report but it does not look realistic to create a folder for each school on the report server (which means about 180 or more folder for all our schools ). Does anyone else have better suggestions what can/should I do?
I have a report on my report server... and it has set for multivalue parameter... but since the particular client has only one plan so they wont have the select all function... but the size of the ddl is so squished that we cannot see the Plan name at all...
So can someone pls help me as to how can i increase it..
1) SSRS in native mode 2) 2012 3) I have "Browser, Content Manager, My Reports, Publisher, Report Builder" permissions on the folder that has the report
I can't see the drop down list associated with the report that's hosted inside the folder. Here's what I mean by drop down list -- the one that lists things like: properties, subscribe, etc. In other words If i click on that dropdown arrow, I don't see the list.
I have an SSIS package created on SQL Server 2005. I have moved this to a SQL Server 2008 R2 server and amended the package on this new server to point at the correct databases.
The package runs manually. However, I cannot see the package when trying to schedule a job. The dropdown list does not contain the package.
I imported the package by right clicking on MSDB and selecting the package from the file system. The package then appears under this folder (SQL Server Integration Services). I then create the SQL job but cannot see the package I just created.