Data Controls :: Error While Converting DataList To PDF
Mar 31, 2014
While I am converting datalist to pdf it diplays below error:
Control 'DataList1_ctl00_RadioButton1' of type 'RadioButton' must be placed inside a form tag with runat=server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Control 'DataList1_ctl00_RadioButton1' of type 'RadioButton' must be placed inside a form tag with runat=server.
Source Error:
Line 52: StringWriter sw = new StringWriter();
Line 53: HtmlTextWriter hw = new HtmlTextWriter(sw);
Line 54: DataList1.RenderControl(hw);
Line 55:
Line 56: StringReader sr = new StringReader(sw.ToString());
I am trying to insert a value in database from a dropdownlistddlvaue = 10.00 - 11.00in db asstarttime=10:00:00endtime=11:00:00using split function
string dropdownvalue = ddlduration.SelectedItem.Text.ToString(); string et = dropdownvalue.Split('-')[1].ToString(); endtime = et.Split(' ')[1].ToString(); starttime = dropdownvalue.Split(' ')[0].ToString(); I am joining date value + time value in the query uisng('" + datevalue + "' + ' ' + '" + starttime + "')
'2014-05-15' + '16.00' --> to get 2014-05-15 16:00:00
it is getting inserted successfullybut while selecting and viewing it from the database I am getting error as,
"Arithmetic overflow error converting expression to data type datetime"
If i mannually enter the date in db it is workingmanuall value=2014-09-30 14:00query value =2014-09-30 14:00
both are same but error is only occuring for query inserted value
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
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.
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)
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);
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
I have datalist in product.aspx page that bind from database and there is Repeater that bind from database... when I click on item from repeater it bind datalist... and I define Label =LBLerrorS that when there isn't any data in database it show this message="There isn't any Product"
In above code I put LBLerrorS.visible=true in else condition... problem is that whenever I select item from repeater it show lblerrors but I want it just show lblerrorS just when there isn't any data in database, actually I want when datalist is empty it show error .... How I can do it?
I have a feedback page with rating controls and I use a stored procedure to insert the record using C#
I get an error when I try to insert about conversion.
[Code]....
I have 20 ratings and a textbox I think the error is with the last parameter @Overall
it displays on the page as 4.9 in a label control, it is previously calculated in the Calculate_Ratings(), and it is declared as a decimal, I have also tried it declared as double. My column is declared decimal(1,1) in sqlDatabase
The Error says
System.Data.SqlClient.SqlException: Error converting data type numeric to decimal. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
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?
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; } }
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.
The problem is that i have a search page. Access Database holding the information. I have a Access Datasource on the page with a Datalist to show the data. I need to find a way on setting it up to says "Sorry no results found" when the is no results. i am unsure on how to do this though.
we are using transactional replication on an sql 2008 server. we try now to add a table to the replication that only consists of 1 culomn of type date and we insert the dates to the table. when we then create the replication we are getting an error on the creation of the snapshot. here is the create table with the insert dates:
USE [Product] GO /****** Object: Table [TimeSlices].[BaseDate] Script Date: 05/03/2010 15:52:24 ******/ IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[TimeSlices].[BaseDate]') AND type in (N'U')) DROP TABLE [TimeSlices].[BaseDate] GO USE [Product] GO /****** Object: Table [TimeSlices].[BaseDate] Script Date: 05/03/2010 15:52:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [TimeSlices].[BaseDate]( [TargetDate] [date] NOT NULL, CONSTRAINT [PK_BaseDate] PRIMARY KEY CLUSTERED ( [TargetDate] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO INSERT INTO [TimeSlices].[BaseDate] SELECT TargetDate FROM [TimeSlices].UDF_GetTravelDateRange(GETDATE()-2 , GETDATE()+1000) attached is the UDF: [Code].... this is the add article: use [Product] exec sp_addarticle @publication = N'Product$(QuoteNumber)', @article = N'BaseDate', @source_owner = N'TimeSlices', @source_object = N'BaseDate', @type = N'logbased', @description = null, @creation_script = null, @pre_creation_cmd = N'drop', @schema_option = 0x000000000803509F, @identityrangemanagementoption = N'manual', @destination_table = N'BaseDate', @destination_owner = N'TimeSlices', @vertical_partition = N'false', @ins_cmd = N'CALL sp_MSins_TimeSlicesBaseDate', @del_cmd = N'CALL sp_MSdel_TimeSlicesBaseDate', @upd_cmd = N'SCALL sp_MSupd_TimeSlicesBaseDate' GO
this is the error we get:
Message: Query for data failed
Stack: at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.ThrowNativeBcpOutException(CConnection* pNativeConnectionWrapper) at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.BcpOut(String strBcpObjectName, String strBcpObjectOwner, String strBaseBcpObjectName, Boolean fUnicodeConversion, String strDataFile, String strLoadOrderingHint, String strWhereClause, Boolean useTableLockHint, Int32 bcpFileFormatVersion) at Microsoft.SqlServer.Replication.Snapshot.SqlServer.BcpOutThreadProvider.DoWork(WorkItem workItem) at Microsoft.SqlServer.Replication.WorkerThread.NonExceptionBasedAgentThreadProc() at Microsoft.SqlServer.Replication.AgentCore.BaseAgentThread.AgentThreadProcWrapper() (Source: MSSQLServer, Error number: 0) Message: Conversion failed when converting date and/or time from character string. Stack: (Source: MSSQLServer, Error number: 241)
why we are getting the conversion error on the snapshot creation?
I recently converted a web application of ours to VS 2008 so that we could upgrade to .net 3.51 framework.
I have been making some changes to the layout, to take advantage of ajax and minimize the amout of data needing to be loaded and the number of postbacks processed.
The problem I am having is when I try to save the data.
The page postback calls a local Sub which reads the form data into local variables and then passes these variables to our assembly.
The primary assembly has 70 parameters which are used to populate one of the tables in our database.
So I have 70 local variables just for this call plus a variable reference to the output of the assembly which contains a property for each of the columns in the associated database record.
There are some additional assemblies called to update other tables so, in all there are 121 locally defined variables in this sub.
Bear in mind that this sub is called from the page load event which has 93 of it's own locally declared variables.
Here is what is happening, when I run the code I am using cdate() to convert the value of a text box to datetime and pass it to my assembly. When doing so it throws a conversion error.
So I created a local datetime variable and converted the value of the control to the datetime and passed the variable to the assembly.
No more error, but the proc did not save the data as it was supposed to.
What I noticed in debugging, on the locals tab, is that every local datetime variable displayed the following message:
Cannot evaluate expression because we are stopped in a place where garbage collection is impossible, possibly because the code of the current method may be optimized
I also noticed that on the watch window the same message would display if I attempted to reference any of the datetime controls on the form.
There are only 3 variables and 3 datetime controls that appear to be affected. the controls are all html input boxes. Every other variable and control on the form behaves normally and I can see their values while debugging, it is just these six that are exhibiting the problem, whats more is that they are not new controls to the form.
I want to change one of my table columns data type. Now the column data type is varchar and i want to change it to float. Updated all the column data to numeric and tried to convert the datatype with the following syntax
alter table vibration_values alter column dis_v float
but getting the error as
Error converting data type varchar to float.
The statement has been terminated.
Suprisingly every thing worked well in sqlserver 2005 and not working in sqlserver 2000.