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);
mycon.Open();
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()));
cmdRegister.ExecuteNonQuery();
mycon.Close();
View 1 Replies
Similar Messages:
Jan 24, 2016
I'm getting the following error base on dropdownlist selectindexchanged: error converting data type nvarchar to bigint
Below is my dropdownlist code:
Protected Sub ddlTaxName_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlTaxName.SelectedIndexChanged
Dim strConnString As String = ConfigurationManager.ConnectionStrings("BytConnectionString").ConnectionString()
Dim strQuery As String = "select TaxName, [Rate(%)] from Sale_Tax where" & " TaxID = @TaxID"
Dim con As New SqlConnection(strConnString)
[Code] .....
View 1 Replies
Aug 31, 2010
This is the code i have used to get LocationID from database with MerchantID. I am getting an exception from Fill dataset part. The error is Error converting data type varchar to bigint.
public DataSet getLocationID(long MerchantID)
{
//long LOCID = null;
try
{
SqlParameter[] parameters = new SqlParameter[]
{
new SqlParameter("@merchantID",MerchantID)
};
string strCommandText = "Select LocationID from Merchant_Location where MerchantID ='@merchantID' order by LocationID ASC";
Debug.WriteLine(strCommandText);
DataSet pds = new DataSet();
SqlHelper.FillDataset(DbConnString, System.Data.CommandType.Text, strCommandText, pds, new string[] { "LocID" }, parameters);
return pds;
}
catch (Exception ex)
{
//LogError("Error Occurred When Retrieving LocationID: " + MerchantID.ToString(), ex);
return null;
}
}
View 2 Replies
Nov 30, 2010
Here is the code:
[code]....
After I try to test the page, I am getting the following error:
System.Data.SqlClient.SqlException:
[b]Error converting data type nvarchar to float. [/b]
[code]....
View 1 Replies
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
May 5, 2010
I have 1,2,3,4,5,6,7,8,9 stored as nvarchar inside Level in my db.
I then have a dropdownlist with values 1,2,3,4,5,6,7,8,9. When a user makes a selection (i.e 1) (Level.SelectedValue.ToString). This builds an sql query via a param like this:
"Select things From MBA_EOI Where level = 1"
When I run the select I get the following error:
Syntax error converting the nvarchar value '1,2,3,4,5,6,7,8,9' to a column of data type int.
I was under the impression that I was dealing with an Nvarchar field and the selected value as string, where does the int conversion come in?
p.s I have also tried Level.SelectedItem.ToString
View 1 Replies
Jan 6, 2010
when i am trying to uedit my recods in gridview this error is coming. I am using SQLDatasource with gridview and for edit purpose i am using stored procedure. I have manually executed the SP and its woring fine. my SP is here
[Code]....
and my SQLDataSource is here
[Code]....
and gridview is here
[Code]....
View 2 Replies
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
Mar 28, 2011
I have a query in SQL Server 2008:
[Code]....
Everything looks fine but I keep getting the error: 'Conversion failed when converting the nvarchar value 'xxxx' to data type int... where xxxx is the the value of @Query.
View 3 Replies
Feb 28, 2011
I am using an adapter to get a list with IN where clause as:
[Code]....
I passed the parameter, CatIDList, with string value 1, 2, 3, 4, 5
However, it returns error of Error converting nvarchar value.
View 3 Replies
Jan 21, 2010
i am store ms word resume to image(BLOB) data type in sql server 2005. now i want to display this resume in HTML page or in text area. and for that i use
[code]....
View 3 Replies
May 7, 2015
how can in sql server show two columns as one column.. one of them is nvarchar and the other is int from two tables i have did this but it give error
select depart.depart_name+input_comp.no_of_depart as department,dbo.depart.depart_id from dbo.depart inner join dbo.input_comp on dbo.depart.depart_id=dbo.input_comp.depart_id group by depart.depart_name,dbo.depart.depart_id,input_comp.no_of_depart
the depart_name is nvarchar datatypeand the no_of_depart is int datatype
the error is
Conversion failed when converting the nvarchar value to data type int.
View 1 Replies
Nov 6, 2013
protected void Update(object sender, EventArgs e)
{
foreach (GridViewRow row in gvStudeff.Rows)
{
[Code].....
View 1 Replies
May 7, 2015
I am using a viewstate to store the company Ids and splitting at hyphen.
protected void onCompanychange(object sender, EventArgs e) {
ViewState["companyID"] += companydropdown.SelectedValue + "-";
String companyids = ViewState["companyID"].ToString();
string pattern = "-";
company_array = Regex.Split(companyids, pattern);
company_length = company_array.Length;
}
Company array is a string array where i have stored the company ids
the problem is company_array[0] has the initial value of the dropdownlist(company) --select company which is why m getting the error(cannot convert data type nvarchar to int) . I have used the same logic in many places in my project it did not give any error.
int count = 0;
company_length = company_length - 1;
while (count < GridView3.Rows.Count && compid_counter < company_length ) {
cmd = new SqlCommand("insertWorkDetais", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@trainerId",trainerID);
[Code] .....
View 1 Replies
Dec 1, 2010
In one of my stored procedure I have to compare two nvarchar datatype values.The values containing both numerical and characters.Which function should I write? And one more problem i.e if a number containing zeros in starting ,I should also match including zeros.But not omit zeros.
View 3 Replies
Jul 14, 2010
I have been messing about with this for hours surely this should be an easy task ....... I have a stored procedured that creates a invoice on a Quotetable one of the parameters is a output parameter Invoice Number this is passed to a label. (Label1) This works great.
I then need to add items to the invoice on a item table so my next stored procedure should take the value of Label1 and update the foreign key quotenumber on the itemtable with the value from label1.
On the aspx page I have a small section for a gridview which shows the current quote with however many items on it using the control
[Code]....
On the ASP page the control for @Quotenumber = Label1 but I get the following error
'Conversion failed when converting the nvarchar value 'Label' to data type int.'
View 3 Replies
Aug 16, 2010
I have a column with nvarchar datatype storing the date. I am using a Gridview to display and edit data of that table. Now when I update the table the nvarchar column containing date in the format mm/dd/yyyy gets converted to Jun 9 2010 12:00AM format. I don't want this to be happening. I don't understand why this is happening as I don't have datetime column.
View 4 Replies
Apr 18, 2010
i have set the type of a column in a table numeric(6,2) but when i insert a value above 9999,99 i get the error
"Arithmetic overflow error converting numeric to data type numeric."
Do you know whats wrong??
ofc thats all through visual studio for an asp site thats why im posting here
View 4 Replies
Nov 1, 2010
I am using the abobe code to encrypt and decrypt a query string ID number.Any ideas to how to make this work with id numbers?Bellow is the code and store procdure.
[Code]....
View 1 Replies
Feb 1, 2011
I have latitudes and longitues in a table but they are in a nvarchar(50) field althought the values are like this -> 39.7355 I need to be able to convert those values to numeric to execute a calculation and update a new field
[Code]....
my radiantlatitude field is of type 'float'
View 3 Replies
Mar 29, 2010
I get this error when I am trying to concatenate the two fields in bold into one field for a datagrid.
select count(cp.iOwnerID) as enrolled,(duration + '' + duration_interval) AS Duration ,session_id,school_id as SchoolId,program_id as ProgramId,convert(nvarchar(10),session_start_date,101) as SessionStartDate, session_class_size as SessionClassSize from dbo.cnSchoolProgramSessions cn with (nolock) left join customerproduct cp on convert(datetime,convert(nvarchar(10),session_start_date,101)) = convert(datetime,convert(nvarchar(10),cp.dtPurchasedate,101)) where record_status = 1 and school_id = '" &
iSchool & "' and program_id = '" & iProgram & "' and (CP.chProductNumber = '" & Me.Label5.Text & "' or CP.chProductNumber IS NULL) group by session_id, school_id, program_id,session_start_date,session_class_size,duration,duration_interval
View 9 Replies
Nov 10, 2012
i am getting this error this my c# code
Collapse | Copy Code
string Patient_name = NameTxtBx.Text, Export_TO = ToTxtBx0.Text;
int PatNoVal;
PatNoVal = Convert.ToInt32(PatNo.Text);
PatNoVal = int.Parse(PatNo.Text);
decimal PatID = decimal.Parse(PatID_NO.Text);
[Code] .....
View 1 Replies
Nov 8, 2010
I would like to know, how to set up the Entity framework to create a nvarchar(50) insted of a nvarchar(4000), when creating a string? by the way I am not using the designer!
View 6 Replies
Mar 25, 2010
Does it make a difference in terms of the actual size of the database if I define one of the columns as nvarchar(100)? If there are restrictions on the form as for how much you can input, let's say 50 characters, does the db save blank spaces from character 51-100 and create a database that is larger than it would be it the column was defined as nvarchar(50)?
View 2 Replies
Feb 22, 2010
On one of our applications we are getting a timeout error on an 'additional details' field in our database, the field type is nVarChar(MAX).
The error seems to be happening when a user enters more than 4000 characters into the additional details field. It is my understanding that this fieldtype can store up to 8gb of data and should be used in stead of the "Text" field type?
We have since limited the user from entering more than 4000 characters via the application, however the DB still contains legacy data - when the 'additional details' with more than 4000 characters is pulled out - "Timeout Error".
View 4 Replies