Showing posts with label visual. Show all posts
Showing posts with label visual. Show all posts

Monday, March 26, 2012

Parent-Child Hierarchies & User-defined hierarchies not appearing in Report Builder

Hi "Team SSAS",

I have this weird situation where Parent-Child hierarchies, and User-defined hierarchies show up in Visual Studio, but once I'vedeployed/processed the solution, they do not appear in Report Builder.

Is this a known product bug, or has someone else encountered this and have a solution, PLEASE?

Thanks in advance and in anticipation

Gregg Withers

gwithers atsymbol jhancock dotsymbol com

Hi Greg,

Report Builder can't handle parent/child hierarchies at all; with user-defined hierarchies it just shows the underlying attributes that make up each level if they themselves are visible. I know, it's a bit rubbish...

Take a look at this white paper for more information:

http://www.microsoft.com/technet/prodtechnol/sql/2005/ssrs_reportmodel.mspx

HTH,

Chris

|||

Chris,

Thanks for your hyperlink to the intro to report models.

I'm having a tough time swallowing that answer - It just doesn't make sense that parent-child hierarchies are not available for ad-hoc reporting. I can't think of any decent-sized organization that does not need an parent-child type org chart. Also, if your answer also pertains to user-defined hierarchies, I have the same response.

Anyone else run into this problem, please?

TIA

Gregg

Wednesday, March 7, 2012

parameters for query

I'm not sure if any1 can answer is on this forum, but any help would be VERY appriceted...

I am creating a report using Visual Studio.Net..I want to write a query using parameters BUT in this case I dont no what the parameter will be...

ie the user can enter a customer account OR a customer group
and sort can be on product OR total sales...

Any ideas?!

Thanks!!! :)The intuitively obvious answer would be to use a stored procedure instead of a query, then build the "smarts" into the procedure. There may be better answers, but that one jumps out at me.

-PatP|||The intuitively obvious answer would be to use a stored procedure instead of a query, then build the "smarts" into the procedure. There may be better answers, but that one jumps out at me.

-PatP

coool... neva dun that wiv stored proc... how would i do that? or do u know any useful links?!

THANKS :)|||Sounds like dynamic sql to me|||Sounds like dynamic sql to meThat is the fools way out... Infinite flexibilty, infinite risk.

I was hoping to kind of leash things a bit, finding a good compromise between flexibility and safety.

-PatP|||So would the best idea be to write a stored proc somefing like this?!:

CREATE PROCEDURE test (@.parameter varchar, @.variable varchar) AS
SELECT * from SALES
where @.parameter = @.variable
GO|||CREATE PROCEDURE test (@.parameter1 varchar, @.parameter2 varchar) AS
SELECT * from SALES
where (Column1 = @.Parameter1 or @.Parameter1 is null)
and (Column2 = @.Parameter2 or @.Parameter2 is null)
...but dump the "select *", and let your interface handle the sorting.|||CREATE PROCEDURE test (@.parameter1 varchar, @.parameter2 varchar) AS
SELECT * from SALES
where (Column1 = @.Parameter1 or @.Parameter1 is null)
and (Column2 = @.Parameter2 or @.Parameter2 is null)
...but dump the "select *", and let your interface handle the sorting.

That cant be write... if they enter a value for parameter 1 (eg 'X' only then the query will become:

where (Column1 = 'X')
and (Column2 is null)

right?! That would not be write...it would return nothing....

:eek: I dun no how 2 right it so the user can enter a account no OR customer name...|||would this work:

if @.Account Is Not Null then
write query using @.Acount in where part
break
else if @.Group Is Not Null then
write query using @.Group in where part

break
end

??|||No, but you should set defaults for the parameters, like so:
CREATE PROCEDURE test (@.parameter1 varchar = null, @.parameter2 varchar = null) AS
SELECT * from SALES
where (Column1 = @.Parameter1 or @.Parameter1 is null)
and (Column2 = @.Parameter2 or @.Parameter2 is null)
If a parameter is submitted, the result set will be filtered on that value. If the parameter is ommitted, no filtering will occur on the column.

Monday, February 20, 2012

Parameterized Query Using Wildcards in VS2005

Hey everyone,

I have a smart device project in Visual Studio 2005 that has a SQL Mobile data source. I am trying to create a parameterized query that utilizes 'LIKE' and wildcards. My query is below:

SELECT LocationID, StreetNum, StreetName, rowguid
FROM tblLocations
WHERE (StreetNum = @.StreetNum) AND (StreetName LIKE '%' + @.StreetName + '%')

However, when I test this on my PDA, I get the following error:

SQL Execution Error.

Executed SQL statement: SELECT LocationID, StreetNum, StreetName, rowguid FROM tblLocations WHERE (StreetNum = @.StreetNum) AND (StreetName LIKE '%' + @.StreetName + '%')
Error Source: SQL Server Mobile Edition ADO.NET Data Provider
Error Message: @.StreetName : deerbrook - FormatException

Does anyone know how to add wildcards to a parameter?

Thanks,

Lee

Hey,

This is an a stored proc, or in an ADO.NET query? What I've had to done in the past is to create a dynamic SQL string, and execute that string using exec or exec sp_executeSQL.

Brian

|||

Hey Brian,

Actually, this is a store proc that is created from within TableAdapter in VS2005.

Lee

|||

Hey,

Well then, being in code, I don't think you could use a variable with that kind of string append... you may have to hard code that value into the string, instead of using a variable. But being in a table adapter, I don't know if that will work. You could try passing the %% in with the string by yourself.

Brian

|||

change the select statement in the adapter wizard to this


SELECT LocationID, StreetNum, StreetName, rowguid
FROM tblLocations
WHERE(StreetNum = @.StreetNum) AND (StreetName LIKE @.StreetName)


change your event code to this


Private Sub FillByButton_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles FillByButton.Click
Try
Me.TblLocationsTableAdapter.FillBy(Me.WorkOrdersDataSet.tblLocations, _
StreetNumTextBox.Text, _
String.format("%{0}%",StreetNameTextBox.Text))
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub


Impotant to note - %value% will not utilize indexes and can lead to poor performance. just keep that in mind.

In places where we have a lot of data that may be seached like this, we provide a combo box with values "equals|begins with|ends with|contains" and attach %'s appropriately. Using the Above formatted SQL accomodates this.

cheers

|||

This question was already answered, but it did not provide you with the internals. You need to set the % in the parameters value.

You create for example the following query:

select * from FOO where BAR like @.P1;

After that you have to create a SqlCeParameter object and set the % in the value of that parameter:

SqlCeParameter parameter = new SqlCeParameter();
parameter.Value = string.Format("%{0}%", value);

The DataAdapter is hiding this here. But if you are working with SqlCeCommand and objects you have to know it.

|||

Are you able to query now with this answer? or still facing some issues?

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

|||Yes, Blair gave me the answer that I needed. Thanks.|||Hi All.

I have same problem with string concatenation.

SqlCeConnection con = new SqlCeConnection("Test.sdf");
SqlCeCommand cmd = con.CreateCommand();
cmd.CommandText = "select firstname + ' ' + lastname from person";
bool i = cmd.ExecuteReader().Read();
cmd.CommandText = "select firstname + @.p0 + lastname from person";
cmd.Parameters.Add("@.p0", " ");
i = cmd.ExecuteReader().Read();

The first query executes fine, but second throws FormatException.
It looks like db expects double value instead of string.|||

Try using Parameter.AddWithValue.

Thanks,

Laxmi

|||Thanks for reply. No difference, i get same result :(.
Here is complete test:

string fileName = "Test.sdf";
File.Delete(fileName);
SqlCeConnection con = new SqlCeConnection("data source=" + fileName);
SqlCeEngine eng = new SqlCeEngine(con.ConnectionString);
eng.CreateDatabase();
con.Open();
SqlCeCommand cmd = con.CreateCommand();
cmd.CommandText = "create table person (firstname nvarchar(100), lastname nvarchar(100))";
cmd.ExecuteNonQuery();
cmd.CommandText = "select firstname + ' ' + lastname from person";
bool i = cmd.ExecuteReader().Read();
cmd.CommandText = "select firstname + @.p0 + lastname from person";
cmd.Parameters.AddWithValue("@.p0", " ");
i = cmd.ExecuteReader().Read();|||

It was my oversight. Parameters can only be used for WHERE Clause. But I see that you are using for SELECT Clause. I really dont know what you are trying to achieve and started using PARAMETERS in SELECT Clause. Can you please elaborate on what is your problem, what is the context ..so that we can have better understanding before we reply.

Thanks,

Laxmi

|||I don't think it depends from context.

cmd.CommandText = "select * from person where firstname + @.p0 + lastname = 'f l";
cmd.Parameters.AddWithValue("@.p0", " ");

bool i = cmd.ExecuteReader().Read();

I this case i get:
The data type is not valid for the boolean operation. [ Data type (if known) = float,Data type (if known) = nvarchar ]

Actually i have generic sql generation system and want to decide - put string in text or pass it as a parameter to sql command.|||

Can you please try this?

cmd.CommandText = "select * from person where firstname = @.p0 AND lastname = 'f l";
cmd.Parameters.AddWithValue("@.p0", " ");

Thanks,

Laxmi

|||After adding missing quote at the end of command text, it executes just fine.
But this is not what i expect. It produces different result.

Parameterized Query Using Wildcards in VS2005

Hey everyone,

I have a smart device project in Visual Studio 2005 that has a SQL Mobile data source. I am trying to create a parameterized query that utilizes 'LIKE' and wildcards. My query is below:

SELECT LocationID, StreetNum, StreetName, rowguid
FROM tblLocations
WHERE (StreetNum = @.StreetNum) AND (StreetName LIKE '%' + @.StreetName + '%')

However, when I test this on my PDA, I get the following error:

SQL Execution Error.

Executed SQL statement: SELECT LocationID, StreetNum, StreetName, rowguid FROM tblLocations WHERE (StreetNum = @.StreetNum) AND (StreetName LIKE '%' + @.StreetName + '%')
Error Source: SQL Server Mobile Edition ADO.NET Data Provider
Error Message: @.StreetName : deerbrook - FormatException

Does anyone know how to add wildcards to a parameter?

Thanks,

Lee

Hey,

This is an a stored proc, or in an ADO.NET query? What I've had to done in the past is to create a dynamic SQL string, and execute that string using exec or exec sp_executeSQL.

Brian

|||

Hey Brian,

Actually, this is a store proc that is created from within TableAdapter in VS2005.

Lee

|||

Hey,

Well then, being in code, I don't think you could use a variable with that kind of string append... you may have to hard code that value into the string, instead of using a variable. But being in a table adapter, I don't know if that will work. You could try passing the %% in with the string by yourself.

Brian

|||

change the select statement in the adapter wizard to this


SELECT LocationID, StreetNum, StreetName, rowguid
FROM tblLocations
WHERE(StreetNum = @.StreetNum) AND (StreetName LIKE @.StreetName)


change your event code to this


Private Sub FillByButton_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles FillByButton.Click
Try
Me.TblLocationsTableAdapter.FillBy(Me.WorkOrdersDataSet.tblLocations, _
StreetNumTextBox.Text, _
String.format("%{0}%",StreetNameTextBox.Text))
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub


Impotant to note - %value% will not utilize indexes and can lead to poor performance. just keep that in mind.

In places where we have a lot of data that may be seached like this, we provide a combo box with values "equals|begins with|ends with|contains" and attach %'s appropriately. Using the Above formatted SQL accomodates this.

cheers

|||

This question was already answered, but it did not provide you with the internals. You need to set the % in the parameters value.

You create for example the following query:

select * from FOO where BAR like @.P1;

After that you have to create a SqlCeParameter object and set the % in the value of that parameter:

SqlCeParameter parameter = new SqlCeParameter();
parameter.Value = string.Format("%{0}%", value);

The DataAdapter is hiding this here. But if you are working with SqlCeCommand and objects you have to know it.

|||

Are you able to query now with this answer? or still facing some issues?

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

|||Yes, Blair gave me the answer that I needed. Thanks.|||Hi All.

I have same problem with string concatenation.

SqlCeConnection con = new SqlCeConnection("Test.sdf");
SqlCeCommand cmd = con.CreateCommand();
cmd.CommandText = "select firstname + ' ' + lastname from person";
bool i = cmd.ExecuteReader().Read();
cmd.CommandText = "select firstname + @.p0 + lastname from person";
cmd.Parameters.Add("@.p0", " ");
i = cmd.ExecuteReader().Read();

The first query executes fine, but second throws FormatException.
It looks like db expects double value instead of string.|||

Try using Parameter.AddWithValue.

Thanks,

Laxmi

|||Thanks for reply. No difference, i get same result :(.
Here is complete test:

string fileName = "Test.sdf";
File.Delete(fileName);
SqlCeConnection con = new SqlCeConnection("data source=" + fileName);
SqlCeEngine eng = new SqlCeEngine(con.ConnectionString);
eng.CreateDatabase();
con.Open();
SqlCeCommand cmd = con.CreateCommand();
cmd.CommandText = "create table person (firstname nvarchar(100), lastname nvarchar(100))";
cmd.ExecuteNonQuery();
cmd.CommandText = "select firstname + ' ' + lastname from person";
bool i = cmd.ExecuteReader().Read();
cmd.CommandText = "select firstname + @.p0 + lastname from person";
cmd.Parameters.AddWithValue("@.p0", " ");
i = cmd.ExecuteReader().Read();|||

It was my oversight. Parameters can only be used for WHERE Clause. But I see that you are using for SELECT Clause. I really dont know what you are trying to achieve and started using PARAMETERS in SELECT Clause. Can you please elaborate on what is your problem, what is the context ..so that we can have better understanding before we reply.

Thanks,

Laxmi

|||I don't think it depends from context.

cmd.CommandText = "select * from person where firstname + @.p0 + lastname = 'f l";
cmd.Parameters.AddWithValue("@.p0", " ");

bool i = cmd.ExecuteReader().Read();

I this case i get:
The data type is not valid for the boolean operation. [ Data type (if known) = float,Data type (if known) = nvarchar ]

Actually i have generic sql generation system and want to decide - put string in text or pass it as a parameter to sql command.|||

Can you please try this?

cmd.CommandText = "select * from person where firstname = @.p0 AND lastname = 'f l";
cmd.Parameters.AddWithValue("@.p0", " ");

Thanks,

Laxmi

|||After adding missing quote at the end of command text, it executes just fine.
But this is not what i expect. It produces different result.

Parameterized Query Using Wildcards in VS2005

Hey everyone,

I have a smart device project in Visual Studio 2005 that has a SQL Mobile data source. I am trying to create a parameterized query that utilizes 'LIKE' and wildcards. My query is below:

SELECT LocationID, StreetNum, StreetName, rowguid
FROM tblLocations
WHERE (StreetNum = @.StreetNum) AND (StreetName LIKE '%' + @.StreetName + '%')

However, when I test this on my PDA, I get the following error:

SQL Execution Error.

Executed SQL statement: SELECT LocationID, StreetNum, StreetName, rowguid FROM tblLocations WHERE (StreetNum = @.StreetNum) AND (StreetName LIKE '%' + @.StreetName + '%')
Error Source: SQL Server Mobile Edition ADO.NET Data Provider
Error Message: @.StreetName : deerbrook - FormatException

Does anyone know how to add wildcards to a parameter?

Thanks,

Lee

Hey,

This is an a stored proc, or in an ADO.NET query? What I've had to done in the past is to create a dynamic SQL string, and execute that string using exec or exec sp_executeSQL.

Brian

|||

Hey Brian,

Actually, this is a store proc that is created from within TableAdapter in VS2005.

Lee

|||

Hey,

Well then, being in code, I don't think you could use a variable with that kind of string append... you may have to hard code that value into the string, instead of using a variable. But being in a table adapter, I don't know if that will work. You could try passing the %% in with the string by yourself.

Brian

|||

change the select statement in the adapter wizard to this


SELECT LocationID, StreetNum, StreetName, rowguid
FROM tblLocations
WHERE(StreetNum = @.StreetNum) AND (StreetName LIKE @.StreetName)


change your event code to this


Private Sub FillByButton_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles FillByButton.Click
Try
Me.TblLocationsTableAdapter.FillBy(Me.WorkOrdersDataSet.tblLocations, _
StreetNumTextBox.Text, _
String.format("%{0}%",StreetNameTextBox.Text))
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub


Impotant to note - %value% will not utilize indexes and can lead to poor performance. just keep that in mind.

In places where we have a lot of data that may be seached like this, we provide a combo box with values "equals|begins with|ends with|contains" and attach %'s appropriately. Using the Above formatted SQL accomodates this.

cheers

|||

This question was already answered, but it did not provide you with the internals. You need to set the % in the parameters value.

You create for example the following query:

select * from FOO where BAR like @.P1;

After that you have to create a SqlCeParameter object and set the % in the value of that parameter:

SqlCeParameter parameter = new SqlCeParameter();
parameter.Value = string.Format("%{0}%", value);

The DataAdapter is hiding this here. But if you are working with SqlCeCommand and objects you have to know it.

|||

Are you able to query now with this answer? or still facing some issues?

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

|||Yes, Blair gave me the answer that I needed. Thanks.|||Hi All.

I have same problem with string concatenation.

SqlCeConnection con = new SqlCeConnection("Test.sdf");
SqlCeCommand cmd = con.CreateCommand();
cmd.CommandText = "select firstname + ' ' + lastname from person";
bool i = cmd.ExecuteReader().Read();
cmd.CommandText = "select firstname + @.p0 + lastname from person";
cmd.Parameters.Add("@.p0", " ");
i = cmd.ExecuteReader().Read();

The first query executes fine, but second throws FormatException.
It looks like db expects double value instead of string.|||

Try using Parameter.AddWithValue.

Thanks,

Laxmi

|||Thanks for reply. No difference, i get same result :(.
Here is complete test:

string fileName = "Test.sdf";
File.Delete(fileName);
SqlCeConnection con = new SqlCeConnection("data source=" + fileName);
SqlCeEngine eng = new SqlCeEngine(con.ConnectionString);
eng.CreateDatabase();
con.Open();
SqlCeCommand cmd = con.CreateCommand();
cmd.CommandText = "create table person (firstname nvarchar(100), lastname nvarchar(100))";
cmd.ExecuteNonQuery();
cmd.CommandText = "select firstname + ' ' + lastname from person";
bool i = cmd.ExecuteReader().Read();
cmd.CommandText = "select firstname + @.p0 + lastname from person";
cmd.Parameters.AddWithValue("@.p0", " ");
i = cmd.ExecuteReader().Read();|||

It was my oversight. Parameters can only be used for WHERE Clause. But I see that you are using for SELECT Clause. I really dont know what you are trying to achieve and started using PARAMETERS in SELECT Clause. Can you please elaborate on what is your problem, what is the context ..so that we can have better understanding before we reply.

Thanks,

Laxmi

|||I don't think it depends from context.

cmd.CommandText = "select * from person where firstname + @.p0 + lastname = 'f l";
cmd.Parameters.AddWithValue("@.p0", " ");

bool i = cmd.ExecuteReader().Read();

I this case i get:
The data type is not valid for the boolean operation. [ Data type (if known) = float,Data type (if known) = nvarchar ]

Actually i have generic sql generation system and want to decide - put string in text or pass it as a parameter to sql command.|||

Can you please try this?

cmd.CommandText = "select * from person where firstname = @.p0 AND lastname = 'f l";
cmd.Parameters.AddWithValue("@.p0", " ");

Thanks,

Laxmi

|||After adding missing quote at the end of command text, it executes just fine.
But this is not what i expect. It produces different result.

Parameterized Query Using Wildcards in VS2005

Hey everyone,

I have a smart device project in Visual Studio 2005 that has a SQL Mobile data source. I am trying to create a parameterized query that utilizes 'LIKE' and wildcards. My query is below:

SELECT LocationID, StreetNum, StreetName, rowguid
FROM tblLocations
WHERE (StreetNum = @.StreetNum) AND (StreetName LIKE '%' + @.StreetName + '%')

However, when I test this on my PDA, I get the following error:

SQL Execution Error.

Executed SQL statement: SELECT LocationID, StreetNum, StreetName, rowguid FROM tblLocations WHERE (StreetNum = @.StreetNum) AND (StreetName LIKE '%' + @.StreetName + '%')
Error Source: SQL Server Mobile Edition ADO.NET Data Provider
Error Message: @.StreetName : deerbrook - FormatException

Does anyone know how to add wildcards to a parameter?

Thanks,

Lee

Hey,

This is an a stored proc, or in an ADO.NET query? What I've had to done in the past is to create a dynamic SQL string, and execute that string using exec or exec sp_executeSQL.

Brian

|||

Hey Brian,

Actually, this is a store proc that is created from within TableAdapter in VS2005.

Lee

|||

Hey,

Well then, being in code, I don't think you could use a variable with that kind of string append... you may have to hard code that value into the string, instead of using a variable. But being in a table adapter, I don't know if that will work. You could try passing the %% in with the string by yourself.

Brian

|||

change the select statement in the adapter wizard to this


SELECT LocationID, StreetNum, StreetName, rowguid
FROM tblLocations
WHERE(StreetNum = @.StreetNum) AND (StreetName LIKE @.StreetName)

change your event code to this


Private Sub FillByButton_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles FillByButton.Click
Try
Me.TblLocationsTableAdapter.FillBy(Me.WorkOrdersDataSet.tblLocations, _
StreetNumTextBox.Text, _
String.format("%{0}%",StreetNameTextBox.Text))
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub

Impotant to note - %value% will not utilize indexes and can lead to poor performance. just keep that in mind.

In places where we have a lot of data that may be seached like this, we provide a combo box with values "equals|begins with|ends with|contains" and attach %'s appropriately. Using the Above formatted SQL accomodates this.

cheers

|||

This question was already answered, but it did not provide you with the internals. You need to set the % in the parameters value.

You create for example the following query:

select * from FOO where BAR like @.P1;

After that you have to create a SqlCeParameter object and set the % in the value of that parameter:

SqlCeParameter parameter = new SqlCeParameter();
parameter.Value = string.Format("%{0}%", value);

The DataAdapter is hiding this here. But if you are working with SqlCeCommand and objects you have to know it.

|||

Are you able to query now with this answer? or still facing some issues?

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

|||Yes, Blair gave me the answer that I needed. Thanks.|||Hi All.

I have same problem with string concatenation.

SqlCeConnection con = new SqlCeConnection("Test.sdf");
SqlCeCommand cmd = con.CreateCommand();
cmd.CommandText = "select firstname + ' ' + lastname from person";
bool i = cmd.ExecuteReader().Read();
cmd.CommandText = "select firstname + @.p0 + lastname from person";
cmd.Parameters.Add("@.p0", " ");
i = cmd.ExecuteReader().Read();

The first query executes fine, but second throws FormatException.
It looks like db expects double value instead of string.|||

Try using Parameter.AddWithValue.

Thanks,

Laxmi

|||Thanks for reply. No difference, i get same result :(.
Here is complete test:

string fileName = "Test.sdf";
File.Delete(fileName);
SqlCeConnection con = new SqlCeConnection("data source=" + fileName);
SqlCeEngine eng = new SqlCeEngine(con.ConnectionString);
eng.CreateDatabase();
con.Open();
SqlCeCommand cmd = con.CreateCommand();
cmd.CommandText = "create table person (firstname nvarchar(100), lastname nvarchar(100))";
cmd.ExecuteNonQuery();
cmd.CommandText = "select firstname + ' ' + lastname from person";
bool i = cmd.ExecuteReader().Read();
cmd.CommandText = "select firstname + @.p0 + lastname from person";
cmd.Parameters.AddWithValue("@.p0", " ");
i = cmd.ExecuteReader().Read();|||

It was my oversight. Parameters can only be used for WHERE Clause. But I see that you are using for SELECT Clause. I really dont know what you are trying to achieve and started using PARAMETERS in SELECT Clause. Can you please elaborate on what is your problem, what is the context ..so that we can have better understanding before we reply.

Thanks,

Laxmi

|||I don't think it depends from context.

cmd.CommandText = "select * from person where firstname + @.p0 + lastname = 'f l";
cmd.Parameters.AddWithValue("@.p0", " ");
bool i = cmd.ExecuteReader().Read();

I this case i get:
The data type is not valid for the boolean operation. [ Data type (if known) = float,Data type (if known) = nvarchar ]

Actually i have generic sql generation system and want to decide - put string in text or pass it as a parameter to sql command.|||

Can you please try this?

cmd.CommandText = "select * from person where firstname = @.p0 AND lastname = 'f l";
cmd.Parameters.AddWithValue("@.p0", " ");

Thanks,

Laxmi

|||After adding missing quote at the end of command text, it executes just fine.
But this is not what i expect. It produces different result.