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.
I have this simple project which needs to show location on a google map by pulling data from the DB.I am using asp.net, mysql DB, google map and i found out from some website that i needed to use ajax.
The process is like this
1. I have a event form where i have multiple fields to fill in and it includes a Location/Venue fields which i can enter a location by Name(Not the Co-ordination). I am located in Singapore. So all fields will be stored into the DB.
2. I have a webpage displaying a table of the data from the same DB, and it comes with a embedded Google Map. On the table, the value of the Location column will be Hyperlinked, and when i click it, it will act as a search query in the embedded google map and locate the address without reloading the page again(which i believe i gotta use iframe?)
I am working on an asp webform that pulls from an ODBC datasource then puts the data in an sql server. Once the data is in the sql server several queries pull data from it to provide information for a report.
This is an example of what I am talking about
private void ODBCpdEmployeeAb() { DataTable dt = new DataTable();
[Code]....
The first part gets the data from the ODBC connection and the next part stores it in an sql server table. The problem is I have these methods in the page load event of the webform so everytime it loads it just puts the exact same data in the sql server table which would then provide incorrect information on the report.
Is there a way to append the most recent data from the ODBC table to the sql server ?
I want to generate a unique random number everytime a user submits a form. As the form is submited the data of the form should be placed in a database and a unique random number should be generated so that the user can later use this unique random number to reterieve his details from the database that refer to his unique random id. The unique random number should be atleast 9 digits long.
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 .
The DoctorGen Table has primary key DocId and Doctors has Keys set on DocId and MemId. I want to get all records from DoctorGen where UserID = @UserId even if there are no matches in the Doctors Table. I'm not getting any records.
I am pulling a date from an Access Database and inserting into my Dataset. I am assigning it to "myDate" and then assigning it to my SQL parameter @StartDate.
When I run my ExecuteNonQuery I get a null value in my SQL database. There are no null values in my access database. I must have the syntax wrong.
I have a select statement that is supposed to be filling grid with information from an income table. It's only supposed to pull if the income is from the current fiscal year or is less than 1 year old. Currently, what it does is pull multiples of rows and also rows from past income years but only if there is a mixture. For instance, if a person has income from 2005 and 2010 what it will show is this
Income 2005 Income 2005 Income 2010 Income 2010 Income 2010
Does anyone know what I've done wrong? BTW, those results are exact, old income is shown twice, current is shown 3X
from tblData left join tblfacility ON tblData.employee_num = tblfacilit.employee_num left join tblextension ext on tblData.extension = ext.extension
tablExtension has phone number extension in it. If we don't know someones phone extension, we put zero for their extension, now there are tons of people who have zero extension.when I run this query, it returns same name lot of times with different cubeNumber so I get
a ax 1 12 0 a ax 1 13 0 a ax 1 14 0 b bx 2 12 0 b bx 2 13 0 b bx 2 14 0
Both emploee a and employee b extensions are zero in above case. I want both a and b to be displayed only once .Right now it is displaying them so many times with all the cubesNumber that have extension zero.
I am looking for a function or procedure in sql server which assists me in figuring out the records which is having Transposed numbers. E.g one record is having invoice number as 1234 and another record is having invoice number as 2134(this is the definition for transposed records for me). My another problem is that the length of invoice number is not known. It can be from 1 character to 15 characters or more than that.
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]...
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.
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)
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.
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.
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?
Region ( ID int, Name varchar(50), Description varchar(51) )
One thing I can use is to retrieve the max(ID) from region and store it in a variable and increment the variable sequentially and insert. But, if any other user inserts a record while I am executing this script then max(id) might clash with the id inserted with other user causing my script to fail.
Is there any other option to insert record sequentially base on the highest number in the table.
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?
Using a class component, an Object data source and a formview I am successfully pulliing data from a SQL database. In some cases the rows contain one or more Null values and I would like them to be ignored completely. My simple code follows:-
I have a GridView, bound to a table (Meals) in a SqlDataSource.
Into that GridView, I have added a TemplateField, which contains a DropDownList (which displays the numbers 1 - 10, added manually; no Data Binding). And, I've added a ButtonField.
When I click the Button, I want the values of some of the GridView rows PLUS whatever value was selected in the DropDownList to be pulled out and stored in a second Sql table (Orders).
Pulling the rows bound to the SqlDataSource is easy but JavaScript is needed (I think) to pull the SelectedValue from the DropDownList. I understand women more than understand JavaScript (that's how little I know) and the code below has been kindly offered by another forum user who is at a loss, himself, now.
Here's the code and the error message I'm getting.
ASPX:
[Code]....
And here's the Code Behind:
[Code]....
No design time errors reported but here's the run time error:
Object reference not set to an instance of an object.
On the following line:
Line 28: if (row.RowType == DataControlRowType.DataRow)