.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

DATEADD number as variable

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :ASP.Net

I'm trying to use a variable in the DATEADD(dd, @dt1, GETDATE()).  This always throws an error, it can't convert the variable properly, but even when I do something like DATEADD(dd, CONVERT(int, @dt1), GETDATE()), still error.

Any help is appreciated!

View Complete Post

More Related Resource Links

Embeb a variable number of videos


I need to provide some alternate content for my non-Flash users.

I have a directory of video files that is scanned using the DirectoryInfo() function, and I want to use the results to embed all files ending in ".mov" in QuickTime players on a web form.

How would you approach this? Right now I am using the count on the array of videos to determine how many times to repeat the embed code.  But this seems inelegant.

Is there a way to have a single QuickTime player.ascx control that gets duplicated according to the number of videos available for display?

Abstract method with variable number of paramters

Hi All,Say I have an abstrac method and I want all my Child classes that inherite this method to have different number of input parameters.e.gabtract class Anything { abstract TestFunc() } class Something1 : Anything { TestFunc(string aa) { ... } } class Something2 : Anything { TestFunc(string bb, int cc) { ... } } How would I go about declaring this in my abstract class?

Need help with "ORA-01036: illegal variable name/number" error on SQLDataSource


I keep gettin this error on the Data Source. Any ideas on how to fix this?


<asp:SqlDataSource ID="sdsLastName" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
	<asp:controlparameter ControlID="ddType" DefaultValue="LAST_NAME"  PropertyName="SelectedValue"  ConvertEmptyStringToNull="true" />


Variable number of colomns in ssrs report



I have a stored procedure which is built on PIVOT fuction. I am using the stored procedure to generate a report.

some time the stored procedure will generate the variable no of colomns, in ssrs dataet is updating with variable no of colomns, at that time report is not supporting.

i am using table control in SSRS. some one suggested me matrix control, but i need to change my stored procedure to work with matirx control.

i dont want to change the stored procedure.

can any one suggest me how to resolve this in SSRS.



Using Excel Source with variable number of columns



I want periodically to insert data from an excel file into a relational table using a SSIS package. However, each time the number of columns in excel may vary. For example, the 1st time the excel file may have 100 rows the second 105 rows etc.

Can this be done in SSIS and if yes what is the solution?


Thanks in advance,


CLR Stored procedures : variable number of input paramters?


Hi there, I've just started looking into CLR stored procedures.

I'd like to create a stored procedure that takes in a variable number of parameters in the same way that sp_executesql does. 

I've tried creating the CLR proc as follows;

using System;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using Microsoft.SqlServer.Server; 

public class StoredProcedures 
  public static void PriceSum(params SqlString[] parms)


but this results in the following error;

Error	1	Column, parameter, or variable #1: Cannot find data type SqlString[].	StringFactory

so I'm guessing it can't be done. 

Is there a way to mimic sp_executesql ?

Variable number of columns in sql for xml


I have a schema where one of my column in xml can appear 0 or 1 time.

That is fairly easy when it is a subquery. But I don't know how to do it in a main query.

Here is an example of what I want:


Local variable scoping in C#

In my previous post, Compiler-generated scopes for local variable declarations, I briefly touched on the issue of multiple meanings applied to the same name. In this post, I'll aim to flush out the compiler's rules with regards to binding names in their local scopes.

Compiler-generated scopes for local variable declarations

I was tasked with understanding and fixing a bug on error reporting with foreach iteration variables the other day, and it got me thinking about local variable scoping rules in C# in general. First, the bug.

Convert English to Arabic number without changing any regional settings in .net

Well, most applications that I worked with was multilingual that supports English UI and Arabic UI.

And one of the major issue that we have faced is displaying Arabic numbers without the need of changing the regional settings of the PC.

So the code below will help you to display Arabic number without changing any regional settings.

dynamically adding sql server columns based on number of files in fileuploader


I want to create a new table to sql database at runtime.  The column names would be "Name", "Date", "Event".  I would also like to have one more column name "Image" but the problem is that since the amount of images will vary, I want the application to count the amount of files in the Multiple fileuploader and then add a image column to the table for the respected amount of files. 

For example if i am uploading 3 files in the multiple fileuploader, the names should be "Name", "Date", "Event", "Image1", "image2", Image3"

I also would like that table name to be name dynamically from the textbox Name when the user enters the information.


I have the following code to make a new table, but I dont know how to name the fields at runtime like previously asked please help!!!


Dim objConn As New SqlConnection("Server=<servername>;uid=<userid>;pwd=<password>;database=master")


Retrieving a variable from a previous page



I'm looking to have a search page where a user will select an item from a listview, then then taken to another page that wil display data based on their original selection.

A user will type in a string and be presented with a list of usernames that are like that string, when they select a user name who's profile they would like to view I would like the page that they're taken to, to be that users profile.

How would I transfer the variable from the search page to the profile page, and when I work on the profile page, how can I access that variable?


How to take value of bound field of grid in a variable or in a textbox.


How to take value of bound field of grid in a variable or in a textbox.

 I m using this code in .aspx page for grid.

<asp:GridView ID="Grd_Mprocess" runat="server" AutoGenerateColumns="False"

                      Width="100%" AllowPaging="True"


                      AllowSorting="True" PageSize="5"  >

                 <RowStyle CssClass="odd" />


<asp:BoundField HeaderText="DOC_TYPE_PK" DataField="DOC_TYPE_PK"  Visible="true" >


  <asp:TemplateField HeaderText="DOC TYPE ID" Visible="true">  &nbs

Article commenting by line number


I'm wondering what's the best way to approach an online article system that allows users to comment by clicking on the line they are commenting about? Essentially the same way Adobe Acrobat works with comments where you can click anywhere and the text is saved for that location.

I'm assuming a mix of jQuery would be the crux of the interface. The system would need to save comments so that when another user logs in, they will also see the other comments but they can´t edit them - only add their own.

Any suggestions would be great.

Hidden variable has no value


I know I have a valid solution, but the js is telling me that the value in the hdnRecordSaved variable has no value!
Even when I specify in my function the following, it still tells me it has no value:
var myTextField = document.getElementById('hdnRecordSaved');

When I put the full value of the variable in (ctl00_ctl00_cphTopCenter_cphCenter_hdnRecordSaved.value), I get the correct contents back ("1"), which I set in my code behind. However, I would prefer to just put the short name in since the masterpages may change, etc. Unfortunately, I know I can get around this with VS2010, but we are using VS2008.

What am I doing wrong with the js naming conventions that can't give me the contents? Here is my below js.

<asp:Panel ID="pnlMapFields" runat="server" ScrollBars="Both" Height="430px">

<telerik:RadTreeView ID="RadTreeView1" runat="server" DataTextField="Description"

DataFieldParentID="MapFieldparentID" DataF

The number of members in the conceptual type ... does not match with the number of members on the ob



I've added a scalar property to an entity and now ASP.NET Dynamic Data scaffolding throws this error:

The number of members in the conceptual type 'TrainingModel.Users' does not match with the number of members on the object side type 'TrainingModel.Users'. Make sure the number of members are the same.

This happens at the following line in global.asax:
model.RegisterContext(typeof(TrainingModel.TrainingEntities), new ContextConfiguration() { ScaffoldAllTables = true });

Please help!

huge number of data from database ... so how to minimize load time


Hi ...

I have used the above method to configure my crystal report ...

Its working fine , But i have huge number of data in database ....

So , it take long time to load the report ...

So , i have decided to show only the last 50 records inserted into the database , not all the 500 records to be loaded every time.

Plz help me with this issue  ...


Also , Plz explain me abt index legend in crystal report.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend