DataSource Controls :: SQL And Chinese / When Try To Retive That Value Need To N Before The Parameter?

May 17, 2010

I have chinese charters stored in a cocloumn . Whn i try to retive that value i need to N before the parameter . How will i give that.

My cose is as follows

String sQuery = "SELECT * FROM " + T_SMS + " " ;
sQuery += "WHERE " +F_ID_SMS + " = @" + F_ID_SMS + " AND " + F_KEY + " = @" + F_KEY;
try
{
SqlCommand myCommand = new SqlCommand(sQuery,this.cConnection) ;
SqlParameter[] arrParameters = this.makeSQLParametersUK() ;
for(int i = 0 ; i < arrParameters.Length ; i ++)
{
myCommand.Parameters.Add(arrParameters[i]) ;
}
if (this.isTransactionAvailable())
myCommand.Transaction=this.cTxn;
SqlDataReader myDataReader = myCommand.ExecuteReader() ;
while(myDataReader.Read())
{
///seting the values
}
myDataReader.Close() ;
}
catch(SqlException e)
{
throw e ;
}

and my makeSQLParametersUK code is as follows
SqlParameter[] arrSqlParameter = new SqlParameter[3] ;
try
{
arrSqlParameter[0] = new SqlParameter("@" + F_ID_SMS,this.getIdSmsNumCorto()) ;
arrSqlParameter[0].IsNullable = false ;
arrSqlParameter[1] = new SqlParameter("@" + F_KEY, this.getKey() +"'") ;
arrSqlParameter[1].IsNullable = false ;
}
catch(Exception ex)
{
}

View 2 Replies


Similar Messages:

DataSource Controls :: Why Can't Write A Sql Filter By Chinese Character

Feb 4, 2010

why i can't write a sql filter by chinese character like the following select name from ABC where name like ' %可%'

View 1 Replies

DataSource Controls :: Variable Connection String Parameter In A DataSource Control

May 20, 2010

I have several web forms which use a GridView linked to a DataSource control which is defined at design time as follows:

<cc1:pgsqldatasource
id="dsStates"
runat="server"
connectionstring="<%&#36; ConnectionStrings:PgSqlConnection %>"
oldvaluesparameterformatstring="Original_{0}"
providername="<%&#36; ConnectionStrings:PgSqlConnection.ProviderName %>" >
</cc1:pgsqldatasource>

As you can see, the connectionstring parameter is defined to a specific connection string name and I need to be able to set such a parameter to a different value, for example, to a session variable content.

View 1 Replies

DataSource Controls :: Access Property Of Object As Session Variable As Declarative Datasource Parameter Value

Oct 27, 2010

I am storing a custom "Organisation" object as a session variable. One of the properties of the Organisation object is "OrganisationID" (integer). I have a DataSource that requires a parameter value to run, and I want to use a SessionParameter to populate this. In a previous version, I stored the OrganisationID directly as a session variable. In that case, I could easily access it like this:

[Code]....

However, how do I now access the OrganisationID property of an "Organisation" type session variable (called "Organisation")? I have tried this, which does not seem to work: <asp:SessionParameter Name="OrganisationID" SessionField="Organisation.OrganisationID" Type="Int32" />

View 2 Replies

DataSource Controls :: Passing Parameter To Datasource In Code Behind?

Mar 25, 2010

I need to pass the control parameter to Sql Datasource in code behind,

<asp:ControlParameter ControlID="DDL_RType" Name="rtype" PropertyName="SelectedValue"

View 3 Replies

DataSource Controls :: SQL Parameter Not Being Sent To Procedure

Aug 3, 2010

What am i missing or doing wrong here, when i debug, im seeing the selected value in the code behind, but when the page loads, it says the following:

Procedure or function 'Onsite_Report_Procedures' expects parameter '@rptNum', which was not supplied.
<asp:SqlDataSource

ID="SQLOnSiteReport"
runat="server"
ConnectionString="<%&#36; ConnectionStrings:connectn %>"
SelectCommand="Onsite_Report_Procedures"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter Name="@rptNum" Type="String" />
</SelectParameters>
</asp:SqlDataSource>

[Code]....

View 2 Replies

DataSource Controls :: How To Get SP Output Parameter From ODS

Aug 4, 2010

I have a stored procedure with output parameter. I encapsulate it with Table Adapter and BLL. Call it using ObjectDataSource in conjuction with formview, just like the one in Data Access Tutorial. How do I get the output parameter in event INSERTED of the ObjectDataSource in code behind (VB)?

My stored procedure looks like this:

[Code]....

My BLL code looks like this:

[Code]....

View 2 Replies

DataSource Controls :: Output Parameter Not Getting Value?

Jul 12, 2010

We have a stored procedure which creates and returns as output the next value in line:

[Code]....

Yes, the dullards who created this system not only failed to use an identity for the primary key of this table, they then proceeded to add 1 to a varchar column to create the new value, thus insuring it can never be anything but numeric.

Sigh. I'm told we cannot address that obvious deficiency now, and we have to leave the column as varchar. Double sigh.

If I execute this sproc from SSMS, the hh_num variable is returned as expected:

[Code]....

However, when I run it through the application, the parameter I set up as output does not get its Value attribute changed:

[Code]....

I've verified that the "@hh_num" maintains its direction and name through the ExecuteNonQuery call, but its Value remains an empty string.

View 1 Replies

DataSource Controls :: Want To Use Parameter In SQL Command?

Jun 5, 2010

I want to use parameter in SQL command, Which the following code is better and why?

string id= getId();
SqlCommand cmd1 = cn1.CreateCommand();
cmd1.CommandText = " INSERT INTO std(idStd) VALUES (idStd=id) ";
cmd1.ExecuteNonQuery();
string idF = getId();
SqlCommand cmd1 = cn1.CreateCommand();
cmd1.CommandText = " INSERT INTO std(idStd) VALUES (idStd=@id) ";
cmd1.Parameters.AddWithValue(@id, idF);
cmd1.ExecuteNonQuery();

View 3 Replies

DataSource Controls :: Declare Parameter In C#?

May 11, 2010

Im in need to export datagrids to excel. I found a good solution in C#. Im a newbie at VB.net. I have got it to work but Im not familar to set the SQL connection and bind data in C#.

I need to declare my query with a calendar parameter but I have no idea how this should be done in this code.

Either, how do I set parameters into the C# code or how can I set a SQLDATASOURCE in the ASPX file and still run all code.

ASPX CODE

[Code]....

And CS

[Code]....

View 3 Replies

DataSource Controls :: Parameter Is Not Valid?

Apr 13, 2010

I'm trying to get image from database into picturebox

pictureBox1.Image = Image.FromStream(new MemoryStream((byte[])ds.Tables[0].Rows[i].ItemArray[0]));

But I am getting error:

parameter is not valid

View 1 Replies

DataSource Controls :: SQLDataAdapter Parameter?

Jan 26, 2010

I have the following sub that I need help with an error on. When run error message is saying that the parameter called by the stored proc was not supplied. Am I missing something? I can't seem to find it.....

[Code]....

View 4 Replies

DataSource Controls :: Beginner With A Parameter ?

Oct 26, 2010


[Code]...

View 3 Replies

DataSource Controls :: Add Parameter To IN Clause In SQL?

Jan 28, 2010

i am developing an application using asp.net and backend server is SQL SERVER 2005.

in my application i have 12 regions. from that 12 regions user will select any of them.

if user select 1,2,3 then i have to pass this string to IN clause

for that i have storedproc like

create procedure sp_updateDistributorContractforAllRegions (
@unitprice float,
@region varchar(50)
)
update employee set UnitPrice=@unitprice where regionid in (@region)
end
GO

here regionid datatype in employee table is INT.

from code behind i am adding the parameter as 1,2,3.when i run the query it gives the error as

Conversion failed when converting the varchar value '1,2,3' to data type int.

View 3 Replies

Data Controls :: Export Repeater / GridView With Chinese (Mandarin) Character To Excel?

Sep 20, 2015

Am Saving the file in Excel format which contains Chinese letters  using C#.NET.

The excel file saved successfully. But the Chinese words are messed up in excel file.

Code Used to Save is :-

Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=" Test.xls");

[Code]..... 

It shows the exact output in website (脚宽 ).  But after saving the file the excel file shows like this (脚宽) . 

Ex:  脚宽 ----> è„šå®½

View 1 Replies

DataSource Controls :: How To Pass Optional Parameter

Apr 22, 2010

I am getting return some data through stored procedure in a asp.net 3.5. Below is the method.

public DataSet GetDataSet(string strConnection,string strSPName, string param1)
{
DataSet ds = dataAccessLayer.getDataSet(strConnection, strSPName);
return ds;
}

In some cases, I have to pass 3-4 parameter. How can we do pass optional parameter here....

View 3 Replies

DataSource Controls :: How To Add Parameter To SqlDataSource1 At Runtime

Aug 24, 2010

I am getting the following error:

Must declare the scalar variable "@Approved"

I want to add a parameter to my SqlDataSource1 when certain controls are checked.

[Code]....

View 4 Replies

DataSource Controls :: Using LoginName As A Search Parameter?

Feb 23, 2010

Im working on my Dissertation and am seriously stuck. Im creating a blogging site with the ability to log in, this will also include the ability to search for projects etc. (created in Visual Studio in VB)

There are different roles: Student, admin, tutor. the table is made up of 2 tables aspnetdb.mdf and blogging.accdb; the first was created by visual studio and the later is mine that contains the projects, bloggs etc.

I want to use the asp:loginName in a search that is sourcing its data from the blogging database, Iv tried for days to do it myself, by trying to write an inner join manually, using its full name etc but keep coming up against a brick wall.

View 1 Replies

DataSource Controls :: Using A Variable As A Parameter In A SQL Statement

Mar 25, 2010

I've done some SSIS package work in the past, but am by no means an expert.

I want to use an SSIS package to do the following:

1. Get the file name of the newest file in a windows folder (using a filename template like his: filename_ *.txt where the * part is always a date in the format of yyyy-mm-dd.

2. Use that file name in later portions of the SSIS package by reading the file and transferring data from it to a SQL table using a Data Flow task.

and use the result (which should be the name of the newest file) to open that file and pull data out of it and into a 2nd SQL table. I admit, I'm not sure how to use the dynamic result of this SELECT query as the file name in a flat file connection manager.

View 6 Replies

DataSource Controls :: SqlDataSource - Parameter For IN() Clause

Apr 30, 2010

I have an SqlDataSource query that should use an input parameter for multiple integer values, like:

select * from table1 where TableID IN (1,2,3,4,5)

->

select * from table1 where TableID IN (@IDValues)

How do I do that ? Default parameter settings won't work, returning "invalid integer value" . I suppose that parameter should be passed as some kind of array that SQL recognizes as multiple integer values , but what's the correct way of setting this ?

View 4 Replies

DataSource Controls :: Passing Parameter From Web Page

Mar 16, 2010

I'm experimenting with an example of code that I found in a book. Here is the HTML:

[Code]....

This looks fine in DesignView.

Here is the VB:

[Code]....

The page loads when I hit F5. I enter initials for a state and click the button and get this error message: 'The connectionstring property has not been initialized'. This line is green:

objConnection.Open()

I'm highly confident that the connection srting is correct. Do I need to Dim another variable or something?

View 6 Replies

DataSource Controls :: How To Capture SQL OUTPUT Parameter

Oct 11, 2010

m trying to capture an output parameter from an SQL insert.for

CREATE TABLE [dbo].[Test](
[TestID] [decimal](18, 0) IDENTITY(1,1) NOT NULL,
[Test1] [int] NULL,
CONSTRAINT [PK_Test] PRIMARY KEY CLUSTERED
INSERT INTO [Test] ([Test1]) OUTPUT inserted.TestID as TestOut VALUES 1))
[code]....

View 3 Replies

DataSource Controls :: Output Parameter Always Returns 0?

Apr 15, 2010

I have a gridview that has the header row modified in order to add new records; the gridview is bound to a sqldatasource control. In my code behind, i handle the insert in the following manner:

[Code]....

I know the insert is occuring because the new record shows up in the grid after the databind, but the output parameter is not picking up the scope_identity() value...what am i doing wrong with the output parameter?

View 2 Replies

DataSource Controls :: Setting Parameter Value From A Variable?

Sep 3, 2010

I create a variable in code behind to save today's date.

[Code]....

And I want to save it as a parameter for an accessDataSource but I'm not finding anywhere that tells me how to do this properly. My attempts thus far have been

[Code]....

View 4 Replies

DataSource Controls :: SqlDataSource Parameter Default Value?

Nov 5, 2010

I am using SqlDataSource control that retrieves information based on a city value from another control (textbox) on the page entered by the user.

[Code]....

The query works fine when the user enters a name of a city. However, if I leave the textbox blank and enter nothing, no records are returned by the query.I need all records to be returned when user leave the textbox blank and there is no value of the city.How to do that?is there a default value can do that?

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved