.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

Filling in the blanks

Posted By:      Posted Date: October 06, 2010    Points: 0   Category :Sql Server


I have 1 fact with 2 dimensions which look like this :

  1 2 3 4 5 Total
1 10   &

View Complete Post

More Related Resource Links

Data Points: Techniques in Filling ADO.NET DataTables: Performing Your Own Analysis


How do you know which technique is best for retrieving data and populating a DataSet in ADO.NET?. Since the Microsoft .NET Framework offers so many choices on how to write the code, many developers are now taking a close look at the different options. See what they are.

John Papa

MSDN Magazine June 2003

problem filling dataset


Hey guys,

Am using a dataset to get different data from a table depending on options selected. Sometimes this means the database returns no matching rows. However with this particular case it seems if there are no rows to put into the dataset I get an "Arithmetic overflow error converting nvarchar to data type numeric." error.

Code looks like this :

Dim saleSelect As String = "SELECT * FROM [sales] WHERE ([affected] LIKE '%' + @affected + '%') AND ([minVal] < @price) AND ([active] = @active)"
Dim saleCmd As SqlDataAdapter = New SqlDataAdapter(saleSelect, sqlConn)
saleCmd.SelectCommand.Parameters.AddWithValue("@affected", "," & id & ":")
saleCmd.SelectCommand.Parameters.AddWithValue("@price", price)
saleCmd.SelectCommand.Parameters.AddWithValue("@active", "True")
Dim saleDs As DataSet = New DataSet()

saleCmd.Fill(saleDs, "saleTbl") 'Error occurs here

The error occurs when SqlDataAdapter attemps to fill the Dataset.

All fields in the table are nvarchar except ofr [id] which is 'int' and [active] which is 'bit'

Any ideas?

Manually Filling a Gridview

I don't want to databind a gridview, I want to be able to add rows myself within c# code.  I can see there is a GridViewRow object and wondered if I can use this to add/remove rows as required?

Filling dropdownlist

Hello, I'm having 2 dropdownlists with id's as ddlCountry and ddlState. The list of Countries and States are in database.I'm using SQLServer 2005 There are two tables in the db named "Country" and "State". Fields of country table are-Cid,Cname Fields of state table are-Cid,Sname I want to display states in ddlState according to the country selected in ddlCountry.  Please help. Thanks and Regards, Priyanka

RegularExpressionValidator - trailing blanks

This is crazy ... ALL I want to do is check for 10 or less AlphaNumeric characters, and ignore any trailing whitespace in the text box I am checking ... I am using this: ValidationExpression   ="^[a-zA-Z0-9]{1,10}$". The validator, however, is returning 10 characters, plus 4 white spaces as an error (ie, "abcfdsitnr    "  ... which should not be an error).  Can anyone help? please? Thanks.

Filling state dropdownlist according to country dropdownlist from database

Hello,I've been looking for an answer to this problem of mine but not yet able to get any solution.Please help me out. I'm having 2 dropdownlists, one for country and another for state.I want the states to be filled according to the country selected from the country ddl. I'm having:  Two dropdownlist controls as-ddlCountry and ddlState Two database tables as-Country and State Country table has fields named- C_ID(pk) and Country State table fields are-S_ID(pk), State, C_ID During page load, I'm able to bind the ddlCountry to the "Country" table in  databaseHence I could bind ddlState too  But I'm getting confused, how to bind the ddlState control so that it will show state as per country selected. I don't want to use ajax Please help me out. Thanks and Regards, Zinnia

Replication entries filling up default trace

I have noticed that a lot of replication related entries are filling up the default trace of my SQL installation, I like the default trace and like to use it for valuable information gathering. One thing that I do notice however is that its being filled with entries like   dbcc setinstance ("SQL Replication Distribution", "Dist:Delivery Latency", @agent_name, @delivery_latency)      dbcc incrementinstance ("SQL Replication Distribution", "Dist:Delivered Trans/sec", @agent_name, @new_delivered_transactions)          dbcc addinstance ("SQL Replication Distribution", @agent_name)            Anywhere I can turn this off and avoid such messages from being logged in the default trace.  

Excel to SQL, building/filling data into SQL

The plan is to 'transfer' from an Excel speradsheet, data into a SQL database. One thought is of course 'how-to-prep' the database to recieve the content of the spreadsheet if necessary. This Excel spreadsheet will be 58,000+ lines of data with each line of data containing more than a few 'fields' of information. These seperate fields of data will be in many different combinations of text, numeric values, dates, etc. Another question will be this 'table data' in the spreadsheet and the transfer into the SQL database, is there any importance as to defining the information in the spreadsheet such as date data (like 01 Jan 2010 as there is many ways to define the date). A second of many possible questions is this transfer. Can the transfer be direct from the 'open file', connect to the database and then 'make the move'? No doubt, many 'think about it first' before doing questions could be asked before 'having been there, done that' experience takes over but till then, one step at a time. Thanks much

Grid with last row filling remaining space


This may be a little hard to explain without pictures but I need have a number of expanders stacked on top of each other in a small window. All of the expanders have varying lengths depending on their content. The last expander must fill up as much of the window as it needs to show its content but no more than hat it needs. The other expanders above it have MaxHeights set. Each expander has its own scrollviewer around it so if it can't show its total content you can scroll through it. I also want each of the expanders to shrink in unison the way multiple grid rows with Height="*" shrink and expand in unison.

I initially thought I could do this with a dock panel with the last child filling the remaining space.

<DockPanel Grid.Row="1"><br/>
  <Border DockPanel.Dock=

Painting/Filling a specific cell using CellPainting event of datagridview



I am trying to paint a quantity column in data grid with color red, however when I do so cell alignment changes to left. 

Seems like I have to convert e.value to string in order for this to work and when I do that the cell alignment changes.

Quantity column is of type decimal.

Also I would appreciate if you can guide on how i can fill the certain columns in data grid with certain color(for ex. yellow).

 if (this.dtaGridView.Columns[7].Index ==e.ColumnIndex && e.RowIndex >= 0)




filling current user name in people picker field when loading form using javascript


Hello guys,

I am looking is there any way to fill the current user's name in people picker field in newform.aspx using javascript?

If you anything, please let me know 


WinForms: Filling Rows in DataGrid Using Threading and yet gridcontrol should be responsive.


WinForms Application. C#, .NET 3.5.


I have a function with searchs data into a non RDBMS Source, collects data and Inserts each found records into DataSet and finally it returns DataSet to main module.  The main module binds returned Dataset to WinForms Grid Control.  When user click on any row, it should display details of selected row.

The search takes quite long time and hence i want to use threading such that as the function find the data it returns the data to main module and main module adds the data into a DataSet object which will be already binded to Grid Control. The Grid control should automatically refresh itself as he finds new data in its underlying databset.  While search is going on the Grid control should remain responseive so that when user clicks on any row, I can call anothr function to retrieve details of the selected row.

I tried using BackgroundWorker still the UI freezes. I observe the grid control does not refresh itself and is non-responsive.

Please guide on how to achieve this and I would really like if there is any sample on similar lines with GridControl.







Problem filling labels with table data outside datalist using single call to db


On a single page, I'd like to fill 2 hyperlink controls as well as a datalist control with table data using one call to the database. The page looks like this:

<div id="PageContent">    
      Please select the district you wish to view below.</p>
      <asp:DropDownList ID="ddlDistrict" runat="server" CssClass="textbox" 
        DataTextField="DistrictName" DataValueField="DistrictId" AutoPostBack="True" 
    <p><asp:label ID="lblDistrictAbbrev" runat="server" Text="District Abbreviation: " />
      <asp:hyperlink ID="hyperlinkDistrictName" runat="server" 
        Text='' NavigateUrl="~/Contact/NationalCouncil.aspx" 
        Font-Bold="True" />
    <p><asp:label ID="lblDistrictCouncillor" runat="server" Text="District Councillor: " />
      <asp:hyperlink ID="hyperlinkCouncillor" runat="server" 
        Text='' NavigateUrl="~/Contact/NationalCouncil.a

Installation filling up System Drive

I have a question regarding Installation of SQL.

Whenever I have my installation files located on D:\(for example), and I instruct SQL during installation to install everything to D:\, there are still a ton of files that get copied to the C:\ partition (%SYSTEMDRIVE%). This is a big problem for me, as most of the customers site I install and configure SQL on, has a very limited amount of space on there System Drive.

Is there a way to make SQL dump these file (Im guessing setup support files and such) to another drive during installation, so the System Drive is not impacted whatsoever?

Also, when ever I install the Service Pack for SQL, even though SQL is installed on D:\, my System Drive (C:\) shrinks dramatically. As with the above question, is there a way to prevent this from happening?

Thanks in advance for any help.

Filling "holes" in sequential data


I'm reporting monthly sales data from a cube that has some missing months.  There are several SQL solutions for joining & unioning such that you can produce a default zero in the data set.  http://www.sqlusa.com/bestpractices2005/datesequencewithrownumber/

 Is there a way to do this with MDX?

Field blanks out as form is being filled in


I have an InfoPath form hosted in SharePoint that has some peculiar behavior. This form was previously hosted in forms services on SharePoint 2007, and worked for several years without problems, but we recently upgraded to 2010, and now I have this issue. The form is used to request that a design project be initiated, and is fairly large - about 100k empty.

There are two different fields in the form that seemingly at random get blanked out as the form is being completed. One is a check box, which determines if a certain workflow step will be performed (create a customer quote), and the other is a rich text field used to enter additional project information. There are no rules that point at the check box to set it's value, but it does have some rules tied to it to set another field if it is selected. And the rich text box has a rule to concatinate a file number to the existing text if a certain button is pushed. That is all. There are no rules in place to clear these fields. In each instance there was additional activity occuring before the form was submitted (other fields were being selected, documents were being attached, dates being entered, etc.).

I managed to duplicate the clearing of the rich text box in troubleshooting, but have not actually seen the check box get cleared. I repeated my steps to get the rich text box to clear, and the second tim

Dynamic Filling of TextBox AutoComplete not working


Hi guys,


i would like to fill the textbox autocomplete stringcollection "on the fly" while typing. i don't want to fill the collection while initializing, 'cause it's too much data: the sql server-table has about 100.000+ rows. the filling takes too much time and the "autocomplete-popup-find-something-box" itself is getting too slow, too.

my configuration:
.NET-Framework: 2.0.50727, System.Windows.Forms.TextBox

TextBox-Properties: AutoCompleteSource: CustomSource; AutoCompleteMode: Suggest

i tried several different things...

1. i did put this code in the "TextChanged"-event, but i think it's 'too late' there:

private void

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