DataSource Controls :: How To Support Lists Of Items In A SQL Database
Jun 26, 2010
Using the products database analogy, i have an application using SQL Database tables, that needs to maintain list's of- applicable products for numerous different scenarios.
I reaslise a database is effectively a list itself, but ideally need some kind of list support as a table field, eg list of type "products" where I can list the primary key id's for each product - how to handle this situation using SQL databases?
I've this checkboxlist with different sports items inside (Example Swimming, Floorball, Basketball and etc). Users are able to check/tick more than one item as they may be interested in lots of different sports. However, I realised that I'm not able to save all the items that the user has checked into the database; only an item will be saved. How can I save all the items that the user has checked into the database?The codes I'm implementing now:cblSportsInterest.SelectedValue (to save the value into the database)
In the user form, the user has a chekboxList, and he can select more than one item.
how can I store those selected items in database, and how then I can retrieve them. " Is it true to make a separate column for each item, and then if selected, then that cloumn will have "1" and "0" for non selected. " Only that idea occurred to my mind, and I think that I can find better it.
Looping Through Checkbox List and adding selected items to MS SQL DatabaseI don't want to store it using comma deliminator.I will need to do a search on analyze which users have what music in common.The image above is from a tbl_lookup_music table I created. MusicID, MusicNow how should I build the logicIF we have a user that has a tbl_profile table. And listens to many different types of music. How should We store the data.------------------------------------------------------------------------------------------CREATE TABLE [dbo].[tbl_lookup_music]( [MusicID] [int] IDENTITY(1,1) NOT NULL, [Music] [nvarchar](64) NOT NULL, ---- Type of music. CONSTRAINT [PK_tbl_lookup_music] PRIMARY KEY CLUSTERED ( [MusicID] ASC )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY----------------------------------------------------------------------------------------------CREATE TABLE [dbo].[tbl_Profile_Music]( [ProfileMusicID] [int] IDENTITY(1,1) NOT NULL, [ProfileID] [int] NOT NULL, [MusicID] [int] NOT NULL,PRIMARY KEY CLUSTERED ( [ProfileMusicID] ASC)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GOHow should I setup this table.
i have over 100 items all loaded in a dropdown list. They all are assigned a value between 1-10 which represent 10 categories. When certain buttons are clicked, i want the dropdown list to display only items with a value "1" or "2", etc.
Id just like to know how to change the appearance of the items such as a the text boxes and drop down lists. And is the the backgroud around the boxes an image?A link to how to do this would be useful if yous cant go into detail on how to do this.
i'm working on a MVC3 webapp and my Model consist of many classes that use a custom type (TextRef) for textual properties. for example my Product entity looks like :
[Code]....
TextRef :
[Code]....
so in my views i'm using :
[Code]....
how could i add validation support to TextRef items ? for example making Product.Title required
i am trying to use predicatebuilder for a linq to sql query but i cant seem to get a join to another table. in my model, i have a table for applicants and another for job applications.. each applicant can have several job applications.
i expect in linq to sql to be able to do something like;
p.jobapptable.jobappdate where p is the applicant.
this isnt the case..i am trying to use predicatebuilder to search through applicants based on the job applications they have made? how`can i get linq to sql to show the foreign key relationships?
It is feasible to Design tables or write SQL to create tables within SQL Server 2008. There are commercial tools such as ERwin ,which provides a graphical interface to create tables, implement relationships, normalise. It is an excellent feature to generate SQL script and generate databases with tables by targetting SQL Server.
I like to know what is the support with in SQL Server 2008 to achieve the same as ERwin.
Please let me know any free tools that can be used as Add-On to SQL Server 2008 to achieve the same.
when make buakup to my data base and open the database digram this error appear : Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.
I'm having trouble writing what should be a simple sub-query using LINQ to Entities. I have two tables: Customers and Orders that have a relation on the CustID field. Not all Customers have a record in the Orders table, while some have mutiple records. In traditional SQL, you could write the query like this: SELECT * FROM Orders where CustID IN (SELECT CustID FROM Customers) I know this could be done as a JOIN in both SQL and L2E, but my actual query is more complex (about 8-9 joins), so I am hoping to find a L2E sub-query equivalent. Something like this:
[Code]....
I know LINQ to Entities does not support the " IN " clause, so I am looking for something that will work in its place.
Iam a newbie in Linq to Sql. I have some problems with my deleting items function. assemble the code together:I must have the following code accumulated.
I am viewing items returned from a dataset in an Infragistics chart control. My problem is that due to a weak point in the control, I am left looking for a way to manipulate the height of the chart based on the count/number of items returned by the ObjectDataSource(DataSet).
Does anyone one have an existing C# sample they could let me view of accessing the count of records returned within the code-behind of a page that I could then use within a case statement to set the hight of the control?
ID Part# Serial# GroupID 1 aa 111 NULL 2 bb 222 1 3 cc 333 1 4 dd 444 1
The groupID relates the various items to the 1st recordI would like a select that will result with the followingID Part# Serial# Partbb_serial# Partcc_Serial# Partdd_Serial#
Here is the situation I have, I have a repeater inside a Usercontrol. The datasource is a IEnumerable<Investor> Exposed through a UserControl's Property. I have overridden the UserControl's databind event to set the Repeater Datasource before databinding the repeater. When it's not a postback, it databinds find and the events on the repeater item's controls fires up fine. But there is one event on repeater items (Delete Investor) which call back the DataBind of the UserControl after removing the Investor from de datasource. When this Event is called, it does all the work (deleting the investor and so on...) calls back the usercontrol's databind but when (within the usercontrol databind) the repeater is databinded again, the repeater items doesn't update (repeater items for investor not on the DataSource anymore still appears). My ItemDataBind doesn't even fire by then.
[Code]....
and code bedind
[Code]....
I Tried with both the Repeater Item Command and each LinkButton Event to see if it would make any difference, but none worked