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


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

Whats wrong with this statement

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net
 

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.


View Complete Post


More Related Resource Links

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

  
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!";
                    break;
                case MembershipCreateStatus.DuplicateUserName:
                    this.CreateAccountResults.Text = "There already exists a user with this username.";
                    break;
                case MembershipCreateStatus.DuplicateEmail:
                    this.CreateAccountResults.Text = "There already exists a user with this email address.";
                    break;
                case MembershipCreateStatus.InvalidEmail:
                    this.CreateAccountResults.Text = "There email address you provided in invalid.";
                    break;
                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

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 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

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 } }  

Can anybody tell me whats wrong in this query?

  

Hi, this is the query for SsisConfiguration. i have done few changes in the main package so i have to change the data files path. Can anybody tell me if this is correct? i have 5 child packages so do i have to do the same thing for all packages?

USE SsisLogs

DECLARE
    @DATABASE VARCHAR(100)
 ,@SERVER VARCHAR(100)
 ,@SUBJECTAREA VARCHAR(100)
 ,@CONFIGURATIONFILTER VARCHAR(500)
 ,@CONFIGURATIONVALUE VARCHAR(MAX)
 ,@CHILDPACKAGEPATH VARCHAR(MAX)
 ,@CHILDPACKAGEPREFIX VARCHAR(MAX)

SET @SUBJECTAREA = 'PlanFinder'
SET @CONFIGURATIONVALUE = '\\uafc.com\ua\MH\DIRFILEDEV\CHG67570\Data'
SET @CONFIGURATIONFILTER = 'FileLocation_'+@SUBJECTAREA

IF  EXISTS (SELECT * FROM [SsisLogs].[audit].[SSISConfig]
WHERE ConfigurationFilter = @CONFIGURATIONFILTER)
BEGIN
UPDATE SsisLogs.Audit.SsisConfig
SET ConfiguredValue = '\\uafc.com\ua\MH\DIRFILEDEV\CHG67570\Data'
WHERE ConfigurationFilter = 'FileLocation_RxCuiToNdc_Load'
END
IF NOT EXISTS (SELECT * FROM [SsisLogs].[audit].[SSISConfig]
WHERE ConfigurationFilter = @CONFIGURATIONFILTER)
INSERT INTO Audit.SSISConfig
(
 ConfigurationFilter
 ,ConfiguredValue
 ,PackagePath
&nb

Whats wrong with this SelectNodes string?

  

I can't fingure out what I'm doing wrong here.

This is a minimized version of how the XML looks like: 

<?xml version="1.0"?>
<rdf:RDF
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns="http://purl.org/rss/1.0/">
  <channel>
    <title> </title>
    <link>http://magicplus.karolinska.se/pc/driftrapportlista.asp</link>
    <description> </description>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
      </rdf:Seq>
    </items>
  </channel>
  <item rdf:about="http://magicplus.karolinska.se/pc/driftrapportlista.asp">
    <

what is wrong with the Following Update Statement

  

I have a Select that is defined like this

 

 

 select C.Number,A.GrpName from TBL_CNTC C
    INNER JOIN TBL_ACTV A
    ON A.CntcID = C.ID
    where A.GrpName <> C.Number

 

and it give me records that dont match in the the field "GrpName" and "Number"  and now i want to Update one table from the other like this

 

 

                UPDATE TBL_CNTC 
		SET Number = A.GrpName
		FROM TBL_CNTC C 
		INNER JOIN TBL_ACTV A 
		ON A.CntcID = C.ID
		where A.GrpName <> C.Number

Now as you can see above i  i want to Update the table TBL_CNTC from the table TBL_ACTV and it looks like like it updated data


(167 row(s) affected)

but

what's wrong in my if - else statement?

  

I have a problem making a couple of if - else statements work. This is what my buttonclick does: It displays ID, last name and firstname of every customer in the database that are registered with the street that is entered in the textbox in question. This works. What doesn't work is when nothing is entered into the textbox (error message label is not showing) or when a street that doesn't exist in the database is entered (error message label is not showing). Can anyone find what's wrong with my code (c#)? Thankful for help!

protected void ButtonSearch_Click(object sender, EventArgs e) 
    {
        LabelNoStreet.Visible = false;
        LabelNoCustomerChosen.Visible = false;
        ListBoxSearchCust.Items.Clear();
        string Street = TextBoxStreet.Text;

        if (Street != null) 
        {
            SqlConnection conn = new SqlConnection(config);
            conn.Open();

              string sql = "SELECT ID, firstname, lastname, street FROM Customer WHERE street='" + Street + "'";
              SqlCommand comm = new SqlCommand(sql, conn);
              SqlDataReader dr = comm.ExecuteReader();

              while(dr.Read())
              {
                  if(Street == Convert.ToString("street")) 
                  {
                        ListBoxSearchCust.Items.Add(&

Whats wrong with this syntax

  

I had issues with updating database with .xls  and .csv files, but got it working.. I need more control over the csv upload, so i was trying a few things i found online for connecting to the file similar to the excel file that works great.

 

I have the follow connections to an xls and csv and the csv logic throws an exception that it cant find the file, even though it was uploaded successfully prior to the reader.

Here is the logic for an excel file and then for the csv, both are identical except for the Extended Properties on the connectionstring, so not sure why its giving that error, the file is uploaded to the folder fine and exists prior to the reader.

{"'C:\\\\inetpub\\wwwroot\\SyNet\\TestSecurity\\Sion\\Sion\\Data\\testAPconfig.csv' is not a valid path.  Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides."}

 

Connection String for .CSV

                            OleDbConnection csvConnection = new OleDbConnection();
                            csvConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                            "Data Source=" + fullName + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited;\"";

                          

sql server 2005 on windows 7 .. Whats wrong?

  

Hi ..

I downloaded Sql server 2005 on Windows 7 And downloaded Sp3  but it is just giving me the Configration tools without the Database Server ..

what the problem please??!!

if any one can help I will be so greatfull ..

Thanks..


whats wrong with this? decimal or whole number?!

  

here is my code, i am getting the data types wrong i think.

label 51 is a whole number from database, label52 could be a decimal number after the division is applied to label 51.

label 53 will be a decimal

label 54 will be a decimal, but id like to show it to the nearest whole number...

how can i get this to work? thanks!

FormView Formview1 = (FormView)sender;
        Label Label51 = Formview1.FindControl("Label51") as Label;
        Label Label52 = Formview1.FindControl("Label52") as Label;
        Label Label53 = Formview1.FindControl("Label53") as Label;
        Label Label54 = Formview1.FindControl("Label54") as Label;

        

        Label52.Text = (int.Parse(Label51.Text) / Convert.ToInt32("144")).ToString();
       Label53.Text = (double.Parse(Label52.Text) * Convert.ToInt32("100")).ToString();
        Label54.Text = (Convert.ToInt32("100") - int.Parse(Label53.Text)).ToString();



Whats wrong with my code?

  

CREATE

 

TABLE [dbo].[TABCPFRF_new](

[IdRegistro] [int]

IDENTITY(1,1)

Whats wrong with my code?

  

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

 

sp_msforeachdb

 

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

BEGIN

USE ?

--drop table tabcpfrf_new

IF (EXISTS (select 1 from sys.objects

where name = ''PK_TABCPF_IdRegistro1''))

BEGIN

ALTER TABLE [dbo].[TABCPFRF_new] WITH CHECK ADD CONSTRAINT [FK_TABCPF_TABCODERRO] FOREIGN KEY([CodErro])

REFERENCES [dbo].[TABCODERRO] ([CodErro])

 

ALTER TABLE [dbo].[TABCPFRF_new] CHECK CONSTRAINT [FK_TABCPF_TABCODERRO]

 

ALTER TABLE [dbo].[TABCPFRF_new] WITH CHECK ADD CONSTRAINT [FK_TABCPF_TABLOTE] FOREIGN KEY([IdLote])

REFERENCES [dbo].[TABLOTE] ([IdLote])

 

ALTER TABLE [dbo].[TABCPFRF_new] CHECK CONSTRAINT [FK_TABCPF_TABLOTE]

 

ALTER TABLE [dbo].[TABCPFRF_new] ADD CONSTRAINT [DF_TABCPFRF_DtConsultaRobo] DEFAULT (ge

whats wrong with this query

  

please help..what's error here...I'm trying to do dynamic Pivot here, please help

CREATE TABLE #DataTbl (ACNAME VARCHAR(50), MONTHNAME VARCHAR(20), TOTALCOUNT INT, TOTALSALES INT)

INSERT INTO #DataTbl
SELECT 'XYZ', 'DEC', 10, 100 UNION ALL SELECT 'XYZ', 'JAN', 13, 300 UNION ALL SELECT 'XYZ', 'FEB', 14, 400
UNION ALL 
SELECT 'PQR', 'DEC', 2, 57 UNION 

Could some one tell me whats the Problem with this String Manipulation ??? C#.net

  

Hi.,

I store some values from code behind to a label which is Hidden !

<asp:Label ID="lbl_Hidden" runat="server" Visible = "false"></asp:Label>

and at the page load event i retrieve the value of the label & assign it to a string !

stringvalue = lbl_Hidden.Text;

Now i dont know why this manipulation does'nt work !

I've a character 'A' in the string and i'm unable to replace it with a space !

stringvalue.Replace(A, " ");

Wot do u think abt it ????


Passing Linq Statement between master and content page

  

I usually work with windows forms, and am just starting to work with ASP.Net, so appologies if this is a dumb question!

I have a master page which has a search button on it. The results of this are built up using a Linq statement and if there are any results, I want to display the results in a contents page.

On the masterpage, I have the following code:

Private _res

    Public Overridable ReadOnly Property SearchRes()
        Get
            Return _res
        End Get
    End Property

 Private Sub DoSearch()
   'some code to get a linq result
   'then

    If res.Any Then
            _res = res
            Server.Transfer("SearchResults.aspx", True)
        Else
            'no results
            LabelNoRes.Visible = True
        End If
 End Sub


On the SearchResults.aspx page I have this code.

Dim m As pxSite = CType(Page.Master, MasterPage)
        If m.SearchRes IsNot Nothing Then
            Label1.Text = "Results found = " & m.SearchRes.Count
        End If


m.searchRes is always nothing. 

What am I doing wrong here?

Thanks


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