Showing posts with label project. Show all posts
Showing posts with label project. Show all posts

Monday, March 26, 2012

Parent-child variable issues that may impact deployment

We are using SSIS for the first time. My team is working on a project that involves putting a date time stamp into a series of tables. These tables are being assembled in a series of child packages being executed by the parent. When the parent runs, we evaluate our timestamp variable as a GETDATE() expression and pass it to the children to be included as a derived column. We don't want the actual runtime of each step to be the timestamp, just the start of the batch (parent).

In order to get the variable to pass over to the child, we needed to set the package location to "file system"instead of "SQL Server". It seems unusual that this would be so. Are we doing something wrong?

What implications does this have for deployment? Will we need to customize the packages for each instance we plan to run this on? Can you have a parent run a child package on a different instance? This would be a performance plus since we have really huge source databases and would like to distribute the processing.

Hmmm, my boss just told me to scratch the whole idea of parent-child and go with a control table to store the variable for all the packages to access. Oh well, I'm still interested in why this is so cumbersome when really its just passing a parameter from one procedure to another.

Oh, and I think you could use a spellchecker on this message box. At least I could use one.

In the child package, create a variable to hold the parent variable. Same name is fine. Then in the control flow, right click on the background and select "package configurations".

Enable package configurations. Then add a new one. Change the configuration type to "parent package variable." Then, in the specify configuration settings entry, enter the name of the variable in the parent package. Next, on the following screen, select the "value" property of the variable created in your child package. (Expand the child variable until you can select the value property.) Click next. Give the configuration a name and hit finish. Done.

Phil|||

Phil,

Thanks, but we already have that functionality. The problem is that we don't like it. We want something more robust, sort of like passing a parameter from one function to another. And we can't even pass a value parameter with this thingy. This parent-child functionality is just plain ugly. We are using a control table instead, but we don't like doing that either.

Friday, March 23, 2012

Partitioning Question

I'm faced with a project that requires the caching of vacations.
Each vacation has a departure date & a price.
The amount of different vacations that will need to be cached is probably near 1 million per day.

I will then need to select the price(s) of vacations for either a single day or a date range (based on the vacation criteria).

I was considering creating a new partition (table with a date on it) every day.
This would allow me to jump into the needed table(s) based on the vacation search criteria. This would also allow me to drop tables with past dates.

I was considering running this all on 1 sql server. I was hoping I could create multiple threads for a datespan search and hit all the tables in the daterange at the same time.

Can you guys enlighten the noob on where I really need some help on this?There's quite a lot of info on this in "Books online" (i.e. the Help that comes with SQL Server). If you follow the set of rules, having a table for each day with a 'check constraint' (e.g. on the date) and a top level view doing a UNION of all the tables it should work quite nicely.

Monday, March 12, 2012

Parameters to Subreports within a matrix

We have a recurring project status report that uses a matrix (each matrix group is for an individual project). The name of the project renders fine and displays in the group, but when we try to pass this same value as a parameter to a subreport (a graph) which we also want to display in the matrix the subreport is only renderd for the last instance of the matrix group (i.e. 4 of 4 has it but 1-3 show a blank field in the matrix).

I assume this has something to do with using parameters within the matrix control, but didn't find any posts about that.

I should add another way we've tried to do this is with a list instead of a matrix and it also fails in the same way (doesn't render all of the subreports).

Thanks for the help,

-p

This may be caued by an interaction between SQL and the Dundas control I'm using. I'm not 100% sure, but thought I'd post this if anyone out there is having a similar problem.

http://support.dundas.com/forum/m.aspx?m=1978&mpage=1&key=subreport

I'll post an answer if I figure out one.

|||As mentioned in the link SP2 fixed this.

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.