.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

Need to make sure area code is in table.

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :
I need to check if area code is there than do nothing else
pad the number with the area code.

There is a new area code being introduce the 431. How should I set this up.

dbo.tblUsers Phone nvarchar(14)
delete #tmp
INSERT INTO #tmp VALUES('(204) 325-4059');
INSERT INTO #tmp VALUES('204-940-1261');


View Complete Post

More Related Resource Links

Create/add table from code to database



I create table:

                  DataSet data=new DataSet();

                  DataTable myTable = new DataTable("NewTable");

                   DataColumn[] keys = new DataColumn[1];

                   // create column
                   keys[0] = new DataColumn();
                   keys[0].DataType = System.Type.GetType("System.String");
                   keys[0].ColumnName = "PointID";
                   myTable.Columns.Add(keys[0]);    &nb

Make sure that the class defined in this code file matches the 'inherits' attribute, and that it e


Here is the page directive for the page that throws the error:

@ Page language="c#" Inherits="University.AspNet.Index" CodeFile="Index.aspx.cs" %>

The code behind file Index.aspx.cs starts like this:

using University.Framework.UI;

namespace University.AspNet

public partial class Index : University.Framework.UI.HomePage

The code behind is extending this HomePage class, which is in turn an extenstion of another class University.Framework.UI.Page, which extends the System.Web.UI.Page class.

Am I misusing the I

Under the Table: How Data Access Code Affects Database Performance


In this article, the author delves into some commonly used ways of writing data access code and looks at the effect they can have on performance.

Bob Beauchemin

MSDN Magazine August 2009

.NET Code Tuning: Make Your Apps Fly with the New Enterprise Performance Tool


Because the common language runtime (CLR) is a black box, it's pretty hard to divine what's going on when you want to track down performance problems. Microsoft will be delivering a brand new profiler, the Enterprise Performance Tool (EPT), as part of Visual Studio 2005 Team Developer Edition that's ideal for use on a production system because it offers some very lightweight means of collecting performance data. Here John Robbins takes you on a tour.

John Robbins

MSDN Magazine December 2004

Debugging: DataTips, Visualizers and Viewers Make Debugging .NET Code a Breeze


There is a whole host of new goodies in upcoming release of Visual Studio 2005 that will enhance your debugging experience. One such improvement will make it easy to visualize types within the debugger. This article discusses those improvements and covers debugger attributes and type visualizers. In addition, the author shows you how to extend the display of your own types with custom attributes and how to plug in an assembly to visualize.NET types built into the framework.

Morgan Skinner

MSDN Magazine May 2004

How to make expanding/collapsing CollapsiblePanelExtender from code behind smooth and animated


I've got a CollapsiblePanelExtender in place on a panel in test and it works like a champ. (I get excited about the simplest things).  When I click the panel header it expands and collapses with smooth animation, as expected and desired.

But when I change its state via code behind, it seems I am merely changing its state and somehow bypassing the javascript that controls the smooth animation.

My markup is out of the box. I have added code behind and some javascript, but I am missing the connection.  Here is the javascript:

function pageLoad(sender, args)

function smoothAnimation()
    var collPanel = $find("CollapsiblePanelExtender1");
    collPanel._animation._fps = 45;
    collPanel._animation._duration = 0.50;


And here is the code behind:

protected void btnExpand_Click(object sender, EventArgs e)
    this.CollapsiblePanelExtender1.Collapsed = false;
    this.CollapsiblePanelExtender1.ClientState = "false";

protected void btnCollapse_Click(object sender, EventArgs e)
    this.CollapsiblePanelExtender1.Collapsed = true;

How to make "UserId" equal to the "logged-in user" in vb code behind


I need to insert a declaration in the codebehind function below that will make the variable "UserId" equal to the "logged-in user". In what way do I need to change the code below (elsewhere in the project, I successfully make reference to basically the same code and make the UserId equal to logged-in user by using this handler expression inside an image control: ImageUrl ='<%# Eval("UserId","Image.aspx?UserId={0}")%>'...But in the case below, the function is not fired by this expression, but rather by CustomValidator). Thanks very much.


Sub ValidateImage(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)

        If Request.QueryString("UserId") IsNot Nothing Then
            ' Get the connection string from Web.config.

            Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("MyDatabaseConnectionString").ToString())
                ' Create a command object.

InfoPath repeating table Copy values from above row without Code

Hi, I have situation, where I want to copy the values from the above row to the newly created row in a Repeating table. Ex. I have a repeating table with 3 columns ID-Name-FileName. When I enter a data like 1-Customer1-File1.zip and hit "Insert new row", the new row should automatically populate the values of the above row. How can I do it without .Net code. Regards,

How to make a default Area in MVC2??

I have the area Blog with controllers (Post and Blog)i want that when the user acess my site without one area, it should redirect him to the Blog area inthe blog controller and in the index actionif i use:            routes.MapRoute(                "ClearPath",                "",                new {area = "Blog",controller = "Blog", action = "Index" }            );i got one error cause he search the view in the root folder: The view 'Index' or its master was not found. The following locations were searched:~/Views/Blog/Index.aspx~/Views/Blog/Index.ascx~/Views/Shared/Index.aspx~/Views/Shared/Index.ascx

How to make backup for Access DB with Code using ADO.net and C#?

Hello , How to make backup for Access DB with Code using ADO.net and C#? ThanksKareem Naguib

How to make a connection between a word in the cell (href)? and a rule of the same or another table

 HelloHow to make a connection between a word in the cell (href)? and a rule of the same or another table with sql. Is there also finished editors?

How to make my application to be minimized directly to the tray icon area ?

I know its a problem . my program most of the time working in the background so most of the time its going to be in the tray icon area. The thing is i can minimize now my application reagulary and it will drop to the left bottom corner and i see only the top of the window of the application so i can resize it. Or i can turn the taskbar property to true and then it will be minimized to the taskbar in the middle . I tried using hid on the taskbar but then i cant resize it from the tray icon cuz its only hiding it in the taskbar not realy moving it to the tray icon . Is there any way or something to make the application move directly to the tray icon area when im pressing the minimize button "-" on my application ? I know there some programs not many but some that when you press the minimize button its going directly to the tray icon. I wonder how they did it.   Thanks for the help .  danieli

How to make background-image of table or panel Rounded ?

Hi, I have taken background-image of a Table and Panel, that image's corner is rectangula. How can i make its corners Rounded ? I searched some online resources, images were made rounded, how to make make background-image rounded on the fly ? 

Trying to figure out the code to calculate the circumference and area of a circle when the diameter


I'm trying to calculate the circumference and area of a circle when the diameter is entered by the user,I need the page to include a text box control to enter the diameter in, a button to post back the page and perform the necessary  calculations on its on_click event and two label controls to display the results,with them rounded to two decimal places,any help would be appreciated,I don't mind paying someone to help me figure this out,but I need it tonight.

How can I make this code work?


I have this code it is work almost correctly but now this code populated data to ALL comboboxes at the time(in the start of UI) the User open the UI.

I need to split the code so when the User select value in combobox corporationCode1 I will advance to combobox WorkSpaceCorporation

for some like this if user select something in combobox CorporationCode1 so advence to combobox WorkSpaceCode..

There is a code/

private void Window_Loaded(object sender, RoutedEventArgs e)



make a control required field using code in infopath


Hello guys,

How do i make a field required field using code. Specifically, how to make attachment control mandatory.

I know there is an option to select cannot be blank in properties but i want to do it conditionally.

Please help me.



Here is my new control code i couldnt make it so if i change the control size on form1 designer so i


I have two major problems.

1. After dragged the control to form1 designer when im on form1 designer i dont see anything in the control only when i run my program. I thought ill some kind of preview or what i painted in the control ill see it on the form1 designer before i run my application.

2. On form1 when i manualy stretch the size of the new control on form1 designer to be bigger or smaller the things i painted dosent fit i thought the way i created the code in the control code it will keep its size arroding to the size changed ill do in form1 designer but it dosent.


So here is the code of the control and form1 can someone help me with this two problems show me the correct code?


First the control code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DannyGeneral;

namespace My_Diet_Control
    public partial class My_Diet_Graph_Control : UserControl
        int x_axis_lenght;
        int y_axis_lenght;

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