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


Post New Web Links

HOw to check whether all rows has been loaded successfully??

Posted By:      Posted Date: September 11, 2010    Points: 0   Category :Sql Server
 
Hi All!   I have one question in mind. I have created package that extract data from sql table and populate in flat file. I used OLEDB source and flat file destination. Now, I have executed the package.  Source tabled has millions of record. After the completion of package, I want to make sure that all rows from table has been loaded into the file  and none of the rows are missed. source table has millions of record. How can i check that in SSIS? It doesn;t make sense to check every row in a file and compare with source. So, How can i do that??     Thanks,  


View Complete Post


More Related Resource Links

How do I check if ExecuteScalar() returned me any rows when you are using casting this way...

  

Hi all

The code below works fine if I have records on my table but if the table is empty I get the following error:

latestTimeStamp1 = (DateTime)cmd.ExecuteScalar(); <=== {"Specified cast is not valid."}

So I am trying to add an IF statement to check if there was any return from ExecuteScalar() method.
How can I verify if something was returned or how can I prevent this cast error from happening?
I managed a workaround by using DataTable and checking if table was null but I need this code to have less overhead as possible since I will be pulling up this timeStamp date all the time.

 DateTime latestTimeStamp1 = DateTime.UtcNow;
 string select = "select max(timeStamp) from Table1";

 SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["Test"].ConnectionString);
		 SqlCommand cmd = new SqlCommand(select, conn);

 try
 {
	 cmd.Connection.Open();
	//if ExecuteScalar returns something 
	//{
	 	latestTimeStamp1 = (DateTime)cmd.ExecuteScalar();
		return latestTimeStamp1;
	//}
 }
 catch (Exception ex)
 {
 }
 finally
 {
	 conn.Close();
 }


Thank you


How to check to see if two rows in sql have the same data as one another?

  

I have a sql query that returns two rows of data, with 10 columns.  Is is possible to compare one row of data to another to determine if they are identical?   If all the fields for a row are identical to all the fields for another row, I'd like to return a "Yes".  If there is any discrepency (no matter if it's in one column, three columns,  or if all ten columns, I want to return a "No". 

I could do this in the code behind by setting all the values to labels and then comparing all the labels, but that seems like a lot of extra craziness.  Can sql compare one row to another in a stored procedure? 


Related Rows are Not Loaded

  

I'm completely stuck on this. I want to have two combo boxes: One for categories and one for subcategories. As a category is selected in one combo box, all the related subcategories are displayed in the other combo box. EF 4.0 should be perfect for this. But the subcategory collections are always empty!

private void InitializeCategories()
{
	// Load categories into memory
	using (BlackBeltEntities context = new BlackBeltEntities())
	{
		cboCategory.DataSource = context.Categories;
	}
}

private void cboCategory_SelectedIndexChanged(object sender, EventArgs e)
{
	Category category = (Category)cboCategory.SelectedItem;
	cboSubcategory.DataSource = category.Subcategories;
}

I can see that Lazy loading is set to true. I tried setting it to false and adding Include("Subcategories") but the subcategories collection is always empty.

I even tried using the SQL Server Profiler. Although I couldn't explain the timing, I could in some cases see the queries to return the subcategories. I even executed the query and it returned the expected results.

I'm really getting frustrated by EF. Although I'm fairly new to SQL Server, I could've had what I'm working on done hours ago. Instead, it's like a black box with no way for me to troubleshoot or determine what the heck is going wrong.

Using a CompareValidator to check input is a valid date

  
The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

  
In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

jQuery: Highlight Gridview Rows with Checkbox

  
Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

Gridview setup:

Highlighting Rows with TextBox OnFocus

  
In another article I explained that how you can make the rows of the GridView control clickable and highlight them when they are clicked. In this article I will explain that how you can highlight the GridView rows when you focus on the TextBox which is contained inside the GridView control.

jQuery: Highlight Gridview Rows with Checkbox

  
Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

jQuery: Styling DropDownList Alternating Items (Rows)

  
In the following example, I will show how you can style any asp:dropdownlist very easily.

The example demonstrates how you can change alternating row items background color, using the fadeTo() to add a nice touch in the dropdownlist. You can change alt rows with a couple lines.

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

  
If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

How to format and update GridView and DataGrid rows using JQuery

  
The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

Check All with JQuery and a Asp.Net GridView

  
Display a Grid on the screen with a checkbox in each row. At the bottom of the page have "Check All" button.

Typically if I need to do anything interesting I use a template column. So my GridView will look like the one below (most other columns removed for readability). The only interesting point to note is the CssClass="ApprovalCheckBox" in the CheckBox ItemTemplate.

Using jQuery to Filter Table Rows

  
The project is using the .net GridView control, so I had limited control over the output HTML code. Still, I think this code can work for most tables. One thing to notice: you should use the class "filterable" on your table or on one of its parents for the code to work.
First, we need a text box:

Insert Rows with a GridView

  
In ASP.NET version 1.x, I used the footer on the DataGrid control to insert new rows by placing a series of TextBox, DropDownLists, CheckBoxes etc. controls on it and then handling a save button. This also works with the GridView in version 2.0 but with one major exception: if your data source is empty, the GridView will hide your footer (and header) and only display the EmptyDataText.

Problem to group radio button across gridview rows

  
In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

RadioButton Groups, Table Rows And NamingContainers in asp.net

  
The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.

RadioButton Groups, Table Rows And NamingContainers

  
(In which AJAX-enhanced CheckBoxes become more useful than RadioButtons but inheritance saves the day, and a simple RadioButton-derived control establishes the purpose of a control's naming container)

The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.
Categories: 
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