DataSource Controls :: Columns Don't Currently Have Unique Values?

May 3, 2010

I am returning a dataset from a method and trying to set one of the columns as Primary Key.

CategoryList.Tables[0].PrimaryKey = new DataColumn[] { CategoryList.Tables[0].Columns["CategoryNodeId"] };

Interestingly it gives me this error at run-time, These columns don't currently have unique values.

Now I perfectly know why this error should error, but there are no duplicate keys in this data column. I broke the code in between and bound the dataset to gridview to check if this column contains any duplicates and this is not the case. Here is the result set underneath. Have a look at the first column 'CategoryNodeId'.

CategoryNodeId
CategoryId
Name
ParentCategoryNodeId [code]...

unable to find a work around for now.

View 3 Replies


Similar Messages:

DataSource Controls :: "These Columns Don't Currently Have Unique Values"

Apr 25, 2010

This is my C# code where i'm trying to fill my dataset from a stored procedure:

[Code]....

My stored procedure:

[Code]....

This a screen shot of my EquipmentStatus Table. The Error occurs when i add new record with the same Fk_MeetRoom, which i need to do when i add a new Equipment. How can i solve this problem? I've tried to use EquipID (alias for EquipmentStatus.ID) when creating the relation in the dataset, but i still get the error.

View 6 Replies

DataSource Controls :: Unique Columns In A Northwind Database

Apr 6, 2010

im creating a database that needs a unique constraint on columns. does anyone know how to add this within the northwind database?

View 4 Replies

DataSource Controls :: Set Up SQL Table Columns To Have Multiple Values?

Mar 9, 2010

Is it possible in to set up an SQL table column to have multiple values? Or would I have to put my values into a new table and link it to the original one?

View 6 Replies

DataSource Controls :: Insert Comma Separated Values Into Multiple Columns Table?

Mar 22, 2010

I've requirement where user can enter multiple columns like first name, lastname, email, age, sex fields and insert them into database.on my frontend aspx page, i'll be showing a single row initially with 5 text boxes(first name, lastname, email, age, sex) and a button to add more columns. when user clicks on add more, another 5 textboxes will be shown and then i'll be taking 5 + 5 (textbox values) and comma seperate them and need to insert into a table with primary auto increment key ID and the remaining 5 columns(firstname, lastname, email, age, sex). I previously worked on the same requirmeent but with only single column. Now i need to insert for 5 columns, How can i do this? Below is my stored proc which i used for single column insertion.

[Code]....

View 12 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

C# - Fill Combo-box Via DataSource Using Values From Various Columns?

Jun 12, 2010

Employee emp = new Employee();
comHandledBySQt.DataSource = emp.GetDataFromTable("1");
comHandledBySQt.DisplayMember = "FirstName";

The above code displays drop list of employees first names in a combo box. I want first name and last name to be displayed. How can i do it?

I tried to include two columns FirstName and LastName as below but didn't work.

comHandledBySQt.DisplayMember = "FirstName" + " " + "LastName";

View 2 Replies

DataSource Controls :: Removing Duplicates From Two Similar Columns Or Any Other Columns In A Database Schema

Apr 21, 2010

I have two columns first name and last name , that have duplicates, how can i remove the duplicates and only leave the distinct members intact?

View 6 Replies

Find Unique Words In One Or More Columns?

Jan 17, 2011

I'm looking at implementing tags in my ASP.NET website. After looking at several algorithms, I'm leaning towards having a couple of database columns that contain one or more tag words. I will then use full-text search to locate rows with specified tags.

All of this seems pretty straight forward except for one thing: I need to be able to generate a list of available tags, which the user can select from.

I know I can write a C# program to build the list of available tags, and then run it once every week or so, but I was just wondering if there's any SQL-method for doing stuff like this more efficiently.

Also, I can't help but notice that the words will be extracted anyway as part of building the full-text index. I don't suppose there's any way to access that information?

View 2 Replies

Forms Data Controls :: Unique Values In Dropdown List At Runtime?

Oct 4, 2010

In given code finally I want to populate unique values at runtime in 2 drop downlist.

protected void Page_Load(object sender, EventArgs e)
{
vidDocument.Load(Server.MapPath("~/CurrentStatus.xml"));
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ExpiresAbsolute = DateTime.Now.AddMonths(-1);

[Code]....

View 2 Replies

Data Controls :: Multiple DropDownList In GridView Populated With Unique Values?

Mar 26, 2016

Multiple DropDownList in GridView populated with unique values in ASP.Net

View 1 Replies

DataSource Controls :: SQL Statement / Don't Have Any Unique Identifier?

Mar 11, 2010

I am just wondering how do I get the very last row of a join statement if I don't have any unique identifier... as in row_number field?Is there a way of creating a dummy column on my SQL statement to hold the record numbers of all records ..[1 to n] etc ???Id like to know how to do this and then I can get the MAX record number.Im using SQL server 2005 so the last() function doesn't work.

View 3 Replies

DataSource Controls :: Insert Row Only When A Certain Field Is Unique?

Jan 3, 2010

For example: INSERT INTO table (col1, col2, col3) VALUES ('value1','value2,'value3')But I would only like to insert the row if value3 isnt already present in col3 in some previous row. What is the best way to do that?And the insert command is run 50+ times in a loop (with different values each time for value3)

View 4 Replies

DataSource Controls :: Unique Numbers For Pulling Data?

Feb 3, 2010

I currently designed a school result portal. If the students want to view their result, they input their student school number in a text box to search out their result. But this is not secured because anybody can look up any students result if you have the number which is even written on their school uniform for identification.

I have being trying to secure this result by trying to generate or code special numbers that the students will input with their school number. The special numbers will be random numbers and may be from 10 and above, it might even contain letters. How do
I code this. I believe this is the best asp.net forum. I want the students to be inputing this special unique numbers and their student numbers so that there result will be avaliable to them.

View 2 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 :: Datatable Defaultview On Unique Date?

Jun 8, 2010

I have a datatable and I want to have a view on it with unique dates. The thing is that I want the date to be unique if the year,month and day are the same, I dont care for the exact time.

I now have:

Dim dtUniqueDates As System.Data.DataTable
dtUniqueDates = dt.DefaultView.ToTable(True, "updatedate")

So in this case 12 february 2011 13:54 is different from 12 february 2011 15:54. But since year,month and day are the same I want them to be unique.

View 1 Replies

DataSource Controls :: Concatenate Field For Unique Identifier?

Feb 3, 2010

I'm using Visual Web Developer Express 2008 and SQL Management Studio Express 2005. I need to link 2 tables to either present in a Master/Detail or GridView/Form view.The goal is to allow the user to view time card information from the AS400 (read only) and then enter any corrections into a SQL table. My problem is in trying to connect the two tables.I've asked the AS400 administrator to add a unique identifier field to the table (HAPOINT), but he says he can't. I've tried to concatenate a field within Visual Web Developer's Query Builder but keep getting errors.Table 1 - exists in AS400, is non-permanent (cleared every 3 months) and can't be modifiedEmpl ID WO Date In Time In Date Out Time Out Table 2 - exists in SQL Server, newly created for this project (no data yet, so can be modified)Rev ID Empl ID Date (of revision entry) X (Revise - y/n) Revised Time In Revised Time Out I tried finding a solution through the SQL Forum, but haven't gotten a solution, so I'm posting here. There are additional details at that post:http://forums.asp.net/p/1516929/3658517.aspx#3658517Can anyone tell me how to concatenate "Empl ID /WO / Date In / Time In" from Table 1 to produce a unique identifier that I can then use in Table 2, thus providing the link between the two tables? Or, is there another way?

View 8 Replies

DataSource Controls :: How To Get The Unique Records Randomly From Data Table

Mar 22, 2010

I have a data table with 20 records i have to get the 15 unique records randomly and have to store it in Arraylist but now problem is that how i select the 15 unique records from Data table each time .

View 9 Replies

DataSource Controls :: Generate A Unique Ref Number And Insert Into The Database

Jul 5, 2010

I am generating a unique Ref number using this sql statement: SELECT REPLACE(STR(CAST(CAST(NEWID() AS binary(5)) AS bigint),12),0,0) as REF Subsequently, I need to insert this REF into sql database table in stored procedure. Here is what I did in my stored procedure:

USE [iBankRecords]
GO
/****** Object: StoredProcedure [dbo].[stp_addPayee] Script Date: 07/05/2010 21:57:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROC [dbo].[stp_addPayee]
(
@CUSTID char(10),
@PAYEEACCNUM nvarchar(20),
@PAYEEACCTYPE char(10) ,
@PAYEENAME char(20),
@PAYERINITIAL char(20),
)
AS
DECLARE
@ReturnValue int
INSERT INTO PAYEE (CUSTID, PAYEEACCNUM,PAYEEACCTYPE,PAYEENAME,PAYERINITIAL, REF)
VALUES (@CUSTID,@PAYEEACCNUM,@PAYEEACCTYPE,@PAYEENAME,@PAYERINITIAL, REF)
IF @@ERROR<>0
BEGIN
PRINT 'ERROR'
SET @ReturnValue=1
RETURN @RETURNVALUE
END
ELSE
BEGIN
SET @ReturnValue=0
RETURN @RETURNVALUE
END

May I know how do I have generating a unique ref num and inserting the REF into the above statement?

View 1 Replies

DataSource Controls :: Violation Of UNIQUE KEY Constraint Visual Basic Error Page

Apr 27, 2010

I'm new to asp.net and I'm building a project in which I send data to a database MSSQL, I've set a constraintname on some fields that I wantto be unique, now how do I catch that error when people insert a duble and handle it with a redirectionto custom error pagehere the code just in case you need it

Dim con As New System.Data.SqlClient.SqlConnection
con.ConnectionString = "Data Source=localhost;Initial Catalog=Database1;User ID=user;Password=password;TrustServerCertificate=True"
Dim myCommand As New System.Data.SqlClient.SqlCommand
myCommand.CommandText = "INSERT INTO serves(CategoryID,UserId,vote, Img, link, Description) VALUES('" & DropDownList1.SelectedValue & "','" & UId.Text & " ' ,1,'" & TextBox1.Text & "','" & "<a href=" + TextBox2.Text + ">" + TextBox4.Text + "</a>" &
"','" & TextBox3.Text & "')"
myCommand.Connection = con
con.Open()
myCommand.ExecuteNonQuery()

View 5 Replies

DataSource Controls :: Unique Number Needed For Tracking Use SQL Server 2005 And Framework 2 - C#

Jul 6, 2010

I have developed a Portal (Request submission) which sends an Email and also it updates all values to the Database. What ever values gets updated to the database, will be sent as an email message to an address. It works fine. I need a Unique number to be generated for a Request submission which has to be sent in the Email message and also it has to be updated in the database. I use SQL Server 2005 and Framework 2, C# laungauge.

View 10 Replies

DataSource Controls :: Create Sql Server Table With Unique Random Identity Between 45365 - 5782155129452?

Jun 12, 2010

How to create sql server table with unique random identity between 45365 - 5782155129452 ?

View 5 Replies

Select/Output Unique Values?

Nov 7, 2010

I need to loop through an XML document (no problem over there) and check if a value that i find is already in a (a) tag in a div in my XSL document that i am generating, only if the value is not in that (a) tag i should create a new (a) tag for it and put in in the div that i am checking... how to do it dynamically in XSLT?

<div id="tags"><span class="l_cap"> </span>
<a href="#" class="current">all</a>
<xsl:for-each select="root/nodes/node/data/genres">[code]....

what i am trying to do is: in the if statement, check if the current value is already exist in the div if not, add it, if is, don't do anything...

View 1 Replies

Web Forms :: Want To Return Unique Values

Mar 18, 2010

I have a text box that has values separated by a comma. I am trying to remove the duplicate values for, example this text box will have values like:

John, Adam, Mike, John, Mike

I want it to return unique values like:

John, Adam, Mike

I found a VB function and converted it to C# but it's giving me errors like newArray is a variable but used as a method. Thanks

public string RemoveDuplicates(string items)
{
StringBuilder Result = new StringBuilder();[code]....

View 9 Replies

SQL Server :: How To Keep Column Values Unique

Aug 7, 2010

I know this is a newbie question but, alas , that's what I am. How do I keep values in specifc sql server table unique, in other words how do I prevent any duplicates happening upon creating (inserting) a new table row?

View 5 Replies







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