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

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

Whats wrong with this code, im getting blue line under the createStatus next the switch

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net
Error message: Use of unassigned local variable 'createStatus'
            MembershipCreateStatus createStatus;
            MembershipUser newUser = Membership.CreateUser(Username.Text, Password.Text, Email.Text);

            switch (createStatus)
                case MembershipCreateStatus.Success:
                    this.CreateAccountResults.Text = "The user account was successfully created!";
                case MembershipCreateStatus.DuplicateUserName:
                    this.CreateAccountResults.Text = "There already exists a user with this username.";
                case MembershipCreateStatus.DuplicateEmail:
                    this.CreateAccountResults.Text = "There already exists a user with this email address.";
                case MembershipCreateStatus.InvalidEmail:
                    this.CreateAccountResults.Text = "There email address you provided in invalid.";
                case MembershipCreateStatus.InvalidPassword:
                    this.CreateAccountResults.Text = "The password you provided is invalid. It must be seven characters long and have at least one non-a

View Complete Post

More Related Resource Links

Whats wrong with my ExecuteScalar() Code ? - C#.net - Plz Help !

Hi,I downloaded OracleHelper & i'm using it....Now i want to insert a row into a table named 'Sample'.I have 2 textboxes and when i click on the button i need to insert the values from 2 textboxes into the table & here is my code....OracleHelper.ExecuteNonQuery(connectionString, CommandType.Text,"insert into sample (id,name) values(?id,?name);", new OracleParameter("@id", OracleDbType.Int32, Int32.Parse(TextBox1.Text)), new OracleParameter("@name",OracleDbType.Varchar2,20,(TextBox2.Text).ToString()));The error i get is,ORA-00911: invalid character and it shows the error is innew OracleParameter("@name",OracleDbType.Varchar2,20,(TextBox2.Text).ToString())Please guide me !

Whats wrong with my code?




TABLE [dbo].[TABCPFRF_new](

[IdRegistro] [int]


Whats wrong with my code?


I´m trying to run the code bellow, but i get an error




' IF ''?'' IN (select name from sys.databases where name in (''Lote_5'', ''Lote_10'', ''Lote_1'') and state = 0)



--drop table tabcpfrf_new

IF (EXISTS (select 1 from sys.objects

where name = ''PK_TABCPF_IdRegistro1''))













Whats wrong with this statement


Im trying to updated some old ASP pages with some new .net pages and cant seem to get this update statement to work. I need to update the current ASP code below and then once thats working im going to use that same statement in a procedure for all our new .Net pages..

So can anyone see what im doing wrong by inserting the 2nd column to the update statement?

strSqual = "update tas set date_completed='" & TransDate & ", trans_id=" & InsertedTransID & "' where date_completed is null and sercontract_id="& strContractID & " and DATEDIFF(dd,task_due_date,'" & strProcDate & "')<=14"


I am trying to add an extra column to the update, but not sure if the syntax is correct.

.net 3.5 in conjunction with CRM 4.0 email router adding code to subject line of emails causing spam

We use CRM 4.0, which is using .net framework 3.5 SP 1.  Emails sent out of CRM go through and email router and the subject line of these emails is getting "=?us-ascii?Q? added to the beginning of the subject line and "?= added to the end of the subject line. This is causing a large amount of our emails getting spammed. I was told by the CRM support that this is an issue with .net 3.5 and won't be fixed until .net 4.0, which CRM won't support for another year.  Is there not a .net 3.5 patch that can address this?

Can someone please explain what this line of code is actually doing

I took this line of control from this post http://forums.asp.net/t/1201593.aspx I'm actually trying to do the same dynamic accordion.   MyAccordion.ItemDataBound += new EventHandler<AccordionItemEventArgs>(MyAccordion_ItemDataBound);    I converted to vb.net and this is the equivalent. MyAccordion.ItemDataBound += New EventHandler(Of AccordionItemEventArgs)(MyAccordion_ItemDataBound) when I type  that line in my code I get an error.. Error 3 'Public Event ItemDataBound(sender As Object, e As AjaxControlToolkit.AccordionItemEventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.    and   Error 4 Delegate 'System.EventHandler(Of AjaxControlToolkit.AccordionItemEventArgs)' requires an 'AddressOf' expression or lambda  

Data from text files, What's wrong with my code?

Hi all, I have uploaded some tab-delimited .txt files on my web site (actually run on my computer, ie localhost, for now), and now I try to retrieve the data from those files. I do this by calling a vb file containg the sub below. Everything works great, except that the sub won't recognise unicode characters. I can split the resulting string using vbnewline and vbtab, but already in the sub in question, the string doesn't understand the Swedish letters åäö, apostrophes and more. Any help would be greatly appreciated! /Pettrer       Shared Function getTextfile(ByVal FullPath As String, Optional ByRef ErrInfo As String = "") As String Dim strContents As String = "" Dim objReader As StreamReader Try objReader =New StreamReader(FullPath) 'UTF8Encoding? strContents = objReader.ReadToEnd() objReader.Close() ErrInfo = Ex.MessageCatch Ex As Exception End Try Return strContents End Function  

How do I obfuscate .Net IL code using command line program?

How do I obfuscate .Net IL code using command line program? I want free tool that can be deployed to obfuscate DLL generated from compiled tool?

Whats wrong with my style?

Im getting a compile error "Error 6 '12' is not a valid value for the 'System.Windows.Documents.TextElement.FontSize'" when I apply my style to a label.  It "looks right", I could use someone elses opinion what is wrong: <Window x:Class="MoneyClient.RevisedScreen" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:net="clr-namespace:System;assembly=mscorlib" Title="Revised Screen" Height="480" Width="600"> <Window.Resources> <net:Int32 x:Key="titleFontSize">12</net:Int32> <Style x:Key="headerStyle" TargetType="Label"> <Setter Property="FontSize" Value="{StaticResource titleFontSize}" /> <Setter Property="FontWeight" Value="Bold" /> </Style> </Window.Resources> <Label Content="Setup" FontSize="12" FontWeight="Bold" Style="{StaticResource headerStyle}"/> </Window> Thnx Mat

set the proerty from code behind line chart wpf

< Style x:Key = " InvisibleDataPointStyle " TargetType = " c:LineDataPoint " > < Setter Property = " Opacity " Value = " 0 " /> < Setter Property = " Background " Value = " Yellow " /> </ Style >

Need vb.net equivalent of this line of c# code....

I have a line of c# that I'm looking to convert into vb.  It looks like the following:return GetFromSession("CurrentUser") as Account; "GetFromSession" is a method which returns an object. Here's the code for that method if it helps:private static object GetFromSession(string key) { if (HttpContext.Current == null || HttpContext.Current.Session == null) { return null; } return HttpContext.Current.Session[key]; } My problem is the "as Account" part of my one line of c# code needs to be converted into vb but I'm not sure of the equivalent. Currently, my vb.net won't allow it. Any idea what I should use here? Thanks  

Help me modify regex code, only one line.

I have this code Dim parts As New List(Of String)(Regex.Split(RichTextBox2.Text, "~\d")) That splits lines in this format into parts: ~1Hello~2~3Bye~4~5Morning~6 So if I do MsgBox(parts(5)), it will show me "Morning". ------------------------------------------------------------------------ I want to do the exact same thing, but now my my line is arranged like this: Hello, Bye, Morning,   

switch case not working - what am I doing wrong

Hi, pretty strange issue with switch case. It is not working. Here is the code:if (!IsAchieved) { //Status will show count of tasks finished for achievement switch (ach.AchievementCode) { case Constants.DEFEAT_VILLAGE_GUARD_CODE : achGridRow.AchStatus = Constants.IN_PROGRESS + userAchParams.VillageGuardDefeated + "/" + ach.AchievementMax; break; case Constants.FIRST_STEP_CODE : achGridRow.AchStatus = Constants.IN_PROGRESS + userAchParams.NoOfMatchSurvived + "/" + ach.AchievementMax; break; default: achGridRow.AchStatus = "Unknown"; break; } }While debugging, I see that even though ach.AchievementCode is same as Constants.FIRST_STEP_CODE, it still goes to default. I also tried removing Constants.FIRST_STEP_CODE and put "FS" but still it is going to default.What could be the possible reason for this behavior? Both ach.AchievementCode and Constants.FIRST_STEP_CODE are string values.I am sure this is something elementary, just missing my eyes. Perhaps you people could

Suffereing with text formatting, whats wrong?

I am outputting a histogram and can't get the labeling of the cells formatted correctly. I want the numbers printed at the bottom of each cell to be centered, but as you can see they are left justified. At the same time the very left number I oversized to see what would happen. This widens the size of the graphic bin which I don't want, I would rather crop the number. What am I missing here, what attributes are missing? I have been playing with this since yesterday and it is driving me nutts. <hbox height="200" width="100" style="border: 2px inset -moz-dialog; margin: 4px;"> <box id="0" flex="1" align="end" width="5%" style="background: -moz-linear-gradient(left, red,red 10%);">2900</box> <box id="1" flex="1" align="end" width="5%" style="background: -moz-linear-gradient(left, red,red 11%);">3</box> <box id="2" flex="1" align="end" width="5%" style="background: -moz-linear-gradient(left, yellow,yellow 12%);">1</box> <box id="3" flex="1" align="end" width="5%" style="background: -moz-linear-gradient(left, yellow,yellow 13%);">1</box> Etc </hbox>

Whats wrong with this condition

I have this condition in my page_load event and it seems to be ignored, i do have it OUTSIDE of my !IsPostback condition. I need to check those sessions EVERYTIME you get to the page, regardless if its the first time on the page or if you have been on the page / site for a while.. those sessions are being set on a different page and this particular page needs those variables in order to work.. so if they dont exist they need to be sent back to the first page so they can be set.   if (Session["ss_t_id"] == null || Session["ss_t_type"] == null) { Response.Redirect("/", false); } ============================================== if (!IsPostBack) { ddlReport.SelectedIndex = 1; if (ddlReport.SelectedValue == "0") { lvReport.Visible = false; filterddl.Visible = false; prtPage.Visible = false; prtAll.Visible = false; } else { DropDownLists are being set in this portion } }  

SharePoint - Defaulting a Value into the obscure SharePoint:FormField controlMode=New code line

I think I've done it before somehow. but can't remember. Is there any way to force a default value into this  Markup? I've tried a few things with no luck.  Iknow i can doing in javascript codek but wanted to double check I might just not be able to force it here. The code below is binding my a column textbox to a list column while in insert mode.  Generated when I ask the DataView Designer to create a NEW button.  I just want to force the value of a querystring parameter into the column and really not even see the column. Thanks     <SharePoint:FormField runat="server" id="ff3{$Pos}" ControlMode="New" FieldName="Title" __designer:bind="{ddwrt:DataBind('i',concat('ff3',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}" />

Help with line of code

 Hello - Can someone explain what is happening with this piece of code. I am not sure about the "==" if (Session["_serial"] + "" == "") Response.Redirect("menu.aspx", true); Thanks,   RD
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