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


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

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

Posted By:      Posted Date: September 04, 2010    Points: 0   Category :ASP.Net
 
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 !


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

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  

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

what is wrong with the below simple code?

  

in a button click I am trying to display a modal popup window
so in the ,cs side button1_click

 Modalpopupextender2.show();

But it is not displaying any thing on the button click. What is missing?

 

<style type="text/css">
     .modalBackground
    {
              background-color:Grey;
              /*Olive; */
              filter:alpha(opacity=70);
              opacity:0.7;
    }
   
     .modalPopup
    {
              background-color:#ffffdd;
              border-width:3px;
              border-style:solid;
              border-color:Gray;
              pad

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

Annoying SQL exception, probably due to some OO/linq code done wrong

  

I started working on this "already started" project, and I'm having a really annoying error when trying to execute some interactions with SQL Server 2008:

The server failed to resume the transaction

One of these errors I get in this specific method call:

The aspx.cs Call:

   

busProcesso openProcess = new busProcesso(pProcessoId);
    try
    {
        if (openProcess.GetDocument() == null)
        {
            //Irrelevant code.
        }
    }
    catch{ //... }



The Business class (relevant part):
     
   
public class busProcesso : IbusProcesso
     {
        public Processo vProcesso { get; set; }

        RENDBDataContext db;

        public busProcesso()
        {
            vProcesso = new Processo();
        }

        public busProcesso(decimal pProcessoId)
        {
            db = new RENDBDataContext();
            try
            {
                 vProcesso = db.Processos.SingleOrDefault(x => x.Id == pProcessoId);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }

        public string GetDocument()
        {
            try
            {
   

What's wrong with this code!?!?

  

I had a piece of code running that is fundamentally the same as the below except it uses temporary tables instead of nested queries. Is there something wrong with what I am trying to do? The one with temp tables works fine...

 

select category_a, category_b, count(customer_name) as instances, sum(spend) as spend 
from 
(
select f.customer_name, category_a, category_b, 
case when category_a = category_b then a.spend else f.spend + j.spend end as spend
from 
(
select customer_name, category as category_a, evidencedspend as spend
from fac_spendtest c join dim_customer d on c.customer_key = d.customerkey
join dim_product e 

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


Exporting data that is in wrong code page in SQL Server

  

Hi,

I have problem, when tryin to export data from SQL Server 2005 using Integration Services.

Sql Server has collation SQL_Latin1_General_CP1_CI_AS (code page 1252), but the actual data is encoded using code page 1257 (SQL_Latin1_General_CP1257_CI_AS). When I look the data using Management Studio, it is displayed wrongly, but when I convert the string to binary, I can see that bytes are encoded using code page 1257. I'm trying to read this data using SSIS 2005, but extended characters are always handled wrongly.

How should I read this data using SSIS?

My first assumption was changing DefaultCodePage to 1257 in my OLE DB Source component (also AlwaysUseDefaultCodePage to true). But without luck.

Also tried to convert data in my SQL Server query using COLLATE, but didn't work.

Is there something I could do to get it working?

 

Thanks


All I see is the asp code, what am I doing wrong?

  

When I load up a .asp page, I just see the code.  How do I get the page to "run"?


Cheers Daniel.


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