DataSource Controls :: Datatype Of The Primary Key Which Should Never End Bigint?

May 10, 2010

Yes..i know this is ASP.NEt forums but the SQL server doubt i will be going to ask is related to ASP.NET

I have a table 'a' in my database where i store User information - each time they visit the website a new record is added

so in a high traffic website - the information will be collectively huge(i dont care about this as i have too much of disk space)

but the problem here is with the primary key - I want a datatype of the primary key which should never end Bigint can store some zillions of records but it finally ends... how will i be able to accomplish it.

View 8 Replies

Similar Messages:

Error In Converting Datatype Nvarchar To Bigint?

Oct 1, 2010

this code is giving me error:

error in converting datatype nvarchar to bigint this is my table values:

@customer_first_name nvarchar(50),
@customer_last_name nvarchar(50),
@customer_address nvarchar(max),
@gender nchar(10),
@date_of_birth datetime,
@customer_email_id varchar(50),
@customer_occuption varchar(50),
@customer_phone_number Bigint,
@nominee_name nchar(50),
@customer_id nvarchar(50),
@account_type nvarchar(50),
@account_number nvarchar(50),
@transfer_access_code nvarchar(50),
@account_balance Bigint,
@pin_code BigInt,
@nationality nvarchar(50),
@password nvarchar(50)
lblAmount.Text = HFamount .Value ;
int balamount = Convert.ToInt32(lblAmount.Text);
int Cpincode = Convert.ToInt32(txtpincode.Text);
long phone = Convert.ToInt64(txtphone.Text);
string cust_id = CUSTOMER_ID_GENERATOR();
string strconstring = ConfigurationManager.ConnectionStrings["ONLINE_BANKING2_ConnectionString"].ConnectionString;
SqlConnection mycon = new SqlConnection(strconstring);
SqlCommand cmdRegister= new SqlCommand(sqlquery,mycon);
cmdRegister.Parameters.Add(new SqlParameter("@customer_first_name",txtcustname.Text.ToString()));
cmdRegister.Parameters.Add(new SqlParameter("@customer_last_name",txtcustlastname.Text.ToString()));
cmdRegister.Parameters.Add(new SqlParameter("@customer_address",txtAddress.Text.ToString()));
cmdRegister.Parameters.Add(new SqlParameter("@gender", rbtngender.SelectedItem.Value.ToString()));
cmdRegister.Parameters.Add(new SqlParameter("@date_of_birth", txtDOB.Text));
cmdRegister.Parameters.Add(new SqlParameter("@customer_email_id", txtemail.Text.ToString()));
cmdRegister.Parameters.Add(new SqlParameter("@customer_occuption", txtcustoccupation.Text.ToString()));
cmdRegister.Parameters.Add(new SqlParameter("@customer_phone_number", phone));
cmdRegister.Parameters.Add(new SqlParameter("@nominee_name", txtnominee.Text.ToString()));
cmdRegister.Parameters.Add(new SqlParameter("@customer_id", cust_id));
cmdRegister.Parameters.Add(new SqlParameter("@account_type", accType.SelectedItem.Value.ToString()));
cmdRegister.Parameters.Add(new SqlParameter("@account_number", ACCOUNT_NUMBER_GENERATOR()));
cmdRegister.Parameters.Add(new SqlParameter("@transfer_access_code",Transfer_code()));
cmdRegister.Parameters.Add(new SqlParameter("@account_balance", balamount));
cmdRegister.Parameters.Add(new SqlParameter("@pin_code", Cpincode));
cmdRegister.Parameters.Add(new SqlParameter("@nationality", DropCountry.SelectedItem.Value.ToString()));
cmdRegister.Parameters.Add(new SqlParameter("@password",txtpasswd2.Text.ToString()));

View 1 Replies

DataSource Controls :: Convert Datetime Value Which Is As Varchar Datatype To Another Datetimeformat As Varcharchar Datatype

Jun 25, 2010

convert below datetime value which is as varchar datatype to another datetimeformat as varcharchar datatype


View 3 Replies

SQL Server :: How To Change Database Table Primary Key DataType From Integer

Mar 7, 2011

There is one table which primary key is ID and its data type is Integer with auto increment. Gradually the value has increased and I want to change it to hold large amount of value.

So, Which in data type I have to change from Integer without effecting the previous values?

View 2 Replies

DataSource Controls :: System.Data.SqlClient.SqlException - Error Converting Data Type Varchar To Bigint?

Jan 16, 2010

I have a website having an aunthentication system. When I am setting my website on IIS 6 the code is absolutly working fine. But when i configure the website on IIS 7 (Windows 2008 server) it is showing me the above error. I am using a stored procedure for it

View 3 Replies

DataSource Controls :: Use Char B/c That Is The Correct Datatype In SQL?

Mar 17, 2010

I'm using DAAB from MS Ent Library 4.1. I have this function in my DAL that returns a dataset.


However, it is failing with this error:Failed to convert parameter value from a String to a Boolean.
But if I use SqlDbType.VarChar instead it works fine. I want to use Char b/c that is the correct datatype in SQL.In my SP the param is @CUSTNMBR char(15). In my database table the field is also char(15).

View 3 Replies

DataSource Controls :: Use Date Datatype In SQL Server 2008?

Feb 26, 2010

I want to filter by database result based on the current date. I have a grid layout which will display the result based on the current date. I am using parameterized query for getting the result but it is not working.given below is the query i am using

<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT TestID, Title, Description FROM aspnet_Test WHERE (Date
<asp:Parameter Name="testdate" DbType="Date" />

and the result should filter on the basis of testdate

String testday, testmonth, testyear,testdate;
testday = System.DateTime.Now.Day.ToString();
testmonth = System.DateTime.Now.Month.ToString();
testyear = System.DateTime.Now.Year.ToString();
testdate.Text = testyear.ToString() + "-" + testmonth.ToString() + "-" + testday.ToString();

but this is not working .It is not showing any error but i am not getting any output.

View 4 Replies

DataSource Controls :: Convert C# Datatype To Database Type?

Jan 22, 2010

I have been looking for a way to convert C# datatype into database specific type of MS SQL. For example when I do [Code]....

I would get System.GUID or something like that but what I want is UniqueIdentifier instead of System.GUID. In most cases, I would also want the length of the type like varchar(1000) and stuff like that. Is there anyway I could convert or get similiar result ?

View 6 Replies

DataSource Controls :: Export To Excel To Sql By Determining Datatype?

Apr 29, 2010

i want to export my excel data to sql server.

The excel data contain

1) id 1,2,3,4.5 which is int type

2) name abhi,soni which of varchar type

3) percentage 40.1,50.1,62.5 which is of type decimal

i wrote an application that will export data to existing sql server table

now what i want is to analyse excel data and then determine the type of data and then create a table with the analyse datatype and then export.

View 2 Replies

DataSource Controls :: Creating Files From Image Datatype Records?

Mar 29, 2010

I've inherited a SQL Server 2005 table where there are several colums of the image datatype. I'd like to extract all of those images and save them as files to a folder. How can I do this using VB.NET?

View 3 Replies

DataSource Controls :: Change The Primary Key Value?

Jan 4, 2010

Let's say I have a table that holds information about books, with a column called bookid as a primary key with auto increment of 1. When I create a couple of records, it assigns 1 to the first row and 2 to the second row for the bookid column. If I delete the second row and enter another row, even though table now only has 2 records, the primary key column says 1 and 3 for their bookids. Is it possible to change back the bookid of the second record from 3 to 2 or is it just server assigned and can't be changed.

View 9 Replies

DataSource Controls :: Datatable Data Types And Command Parameter Datatype?

Apr 7, 2010

I am using VS 2008.I am building a datatable of records to be inserted into a SQL Server 2005 table.
The program loops through this table and builds a SqlParameter for each DataColumn in the datatable. The SqlParameters are used in the SQL Insert statement.

The field I am having a problem with is of type 'bit' in the database table and has no default value and cannot be nulls. The field is called 'Active' The meaning of this field in the application is Boolean i.e True or False. When inserting the record, I wish to default the field to "False".

When I define the columns in the datatable I am forced to use the following code to build the datatcolumn containing the boolean field i.e. dtcActive.DataType = GetType(Boolean) as there is no GetType(Bit)

Dim dtcActive As New DataColumn("Active")
dtcActive.DataType = GetType(Boolean)
dtcActive.Unique = False
dtcActive.AllowDBNull = False
dtcActive.DefaultValue = False

However, when I build the SqlParameter I am forced to use this:

If field.ColumnName = "Active" Then
prm.SqlDbType = SqlDbType.Bit
prm.Value = "False"
End If

This is because there is no SqlDbType.Boolean. The problem I have is there is no value I have been able to give the SqlParameter that is accepted by the Insert statement. It complains that the boolean field cannot be null on Insert.

View 1 Replies

DataSource Controls :: Alter Script To Change The Primarykey Column Datatype?

Feb 22, 2010

I am using SQL SERVER 2008 database. I have a table Customers in which the CustomerID column is had datatype INT intially but due to increase in Customers the number range is exceeding which may cause error arithmetic overflow of data. Hence I thought to modify the datatype from INT to BIGINT and wrote an alter script but when I ran the script it failed. Hence provide me in creating alter script for the updating the datatype of the primarykey column for the Customers table.

View 2 Replies

Forms Data Controls :: Values From Multiple (non Primary And Primary) Datakeys?

Mar 6, 2011

I have the following gridview (ID=Gridview1)

I have added pid (primary key), chkblood,chkurine,chkstool,chkmalaria as datakeynames.

what I want to pull off here is .... when I click select I'll be redirected to this wizard


I did I want to hide / skip steps in the wizard depending on the condition of checkboxes (chkblood, chkurine,chkstool,chkmalaria)

but I cant get the value from these non-primary datakeynames...

View 2 Replies

DataSource Controls :: Dml For Primary And Foreign Key Tables?

Jun 3, 2010

how i insert,update and delete data in multiple table .such tables in which primary and foreign key constraint are

View 1 Replies

DataSource Controls :: Returning Primary Key Of New Database Row

Jul 9, 2010

In my application, users fill out a form to submit a "Job Request" - once they submit the form it is stored as a new row in a table in the Sql database. Each "Job Request" that is submitted is given a "JobID" which is a number and also the primary key of the new row in the database (the number is generated by the database). Once the users hit the "submit" button, I'd like to return the value of the "JobID" (the primary key) so that the user can know what it is. How would I achieve this? In the future, I will have to expand the application so that the users would be able to edit an older "Job Request" and get a similar JobID number (so if before it was 1234, the new one would be 1234-1 or something like that), so this is not simply a matter of searching for the highest number in the primary key field in the table and returning that. I'm using Sql for my database and writing in VB.

View 1 Replies

DataSource Controls :: Inserting Primary Key Automatically?

Jan 19, 2010

My codes below are to insert a new data into the database. The thing is, this code can insert the primary key(DeviceID) into the database automatically but I cant seem to find the code to insert the primary key into the database. point me the statement that insert primary key(DeviceID)..

This is the snippet of the submit button event

Protected Sub SubmitDevice_Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubmitDevice_Button.Click If Session("canUploadBool") = False Then ClientScript.RegisterStartupScript(Me.GetType,
"canuploadScript", "")
Exit Sub
Dim insertNewProcess As String = "INSERT INTO Device_Table("
Dim deviceColumn As String = "DeviceRevision, CustomerName, CustomerCode, CustomerResponsibleEngineer, Date, DevicePartNumber, PackageType"
Dim deviceValue As String = ") VALUES ('01', '" + CustNameDropDownList.SelectedValue.ToUpper + "', '" + CustCodeLabel.Text + "', '" + CustomerResponsibleEngineerTextBox.Text.Trim.ToUpper + "', '" +
Format(Now, "dd-MMM-yyyy").ToUpper + "', '" + DevicePartNumberTextBox.Text.Trim.ToUpper + "', '" + PackageTypeTextBox.Text.Trim.ToUpper + "'"

View 4 Replies

DataSource Controls :: Make A Three Primary Key In One Table?

Jan 3, 2010

i have to make a three primary key in one table

View 2 Replies

DataSource Controls :: How To Get The Primary Key Of The Newly Inserted Record

May 10, 2010

I am using a FormView to populate data, then inserting it using a LinqDataSource. The primary key is an autoincrementing identity. I'd like to handle the ItemInserted event to update some other tables, but I cannot find how to get the primary key of the newly inserted record. The insert happens fine, but nothing for the PK.

I realize I can change to using a SPROC, or change to creating the new row and doing the insert myself, but I'd prefer to continue with the LinqDataSource's automatic insert.

How can I get the PK?

View 2 Replies

DataSource Controls :: LINQ / Insert Records Without Having Primary Key?

Apr 29, 2010

I am using LINQ Expression to insert records in SQL Table. My Table dosen's have any Primary Key Field. Whenever I Am trying to Insert Records in Table using LINQ Expression, this always occurs an Error that 'the Table You are using to insert Dosen't Have Any Primary Key Field.

How I Will Insert Records Without Having Primary Key ?

View 1 Replies

DataSource Controls :: Sql Server Filestream / Table Stores The Documents And The Datatype Of The Field Is IMage?

May 27, 2010

In of my application I am using the database to store and retrive images. The table stores the documents and the datatype of the field is IMage.

Now with Sql Server 2008, i would like to upgrade this to use this new feature. WHat changes do I have to make in terms of code and also in the database.

View 5 Replies

DataSource Controls :: Automatically Insert Uniqueidentifier In Primary Key Attribute?

Feb 14, 2010

When a user creates an account for my web application using the create user wizard additional steps have been added to take more details and store them in another table. Now this tables primary key is set to uniqueidentifier, is it possible to have that unique identifier automatically generated when the query is run to insert a new row for a new user?

View 1 Replies

DataSource Controls :: Using Views With EntityFramework Is Not Able To Recognize Primary Keys

May 2, 2010

Cannot seem to find a good fit for my question so I will ask here.

Does Asp.Net 4.0 solve the problems with using Views with EntityFramework is not able to recognize primary keys.

View 2 Replies

DataSource Controls :: Error 3033 : Their Primary Keys May Collide

Jan 15, 2010

I have started my new mvc project with entity framework,Must say it is very diffcult to work with entity framework.

"I am trying to create new custom entity in .edmx file,Now i have made one column as Entity key,Which is already entity key another entity set."

"Error 3033: Problem in Mapping Fragment starting at line 3081: EntitySets 'Entityset name' and 'Entityset name' are both mapped to table 'Entityset name'. Their Primary Keys may collide."

View 8 Replies

DataSource Controls :: Attribute To Be The Foreign Key Which Is Not A Primary Key In The Original Table?

Jul 2, 2010

attribute to be the foriegn key which is not a primary key in the original table?

View 1 Replies

Copyrights 2005-15, All rights reserved