Showing posts with label form. Show all posts
Showing posts with label form. Show all posts

Sunday, March 25, 2012

Configuration failing: The path is not of a legal form.

When I push Add in the configuration dialog, I cannot even get to the first page of the configuration wizard, due to the following error, in several solutions (but not in several others). All have at least one existing configuration (necessarily, to get passwords for connections).
**
An error occurred while a new configuration was being added.
Additional Information:
The path is not of a legal form. (mscorlib)

**

PS: How have the rest of you been posting? Passport hasn't been working much this week, so I've been unable to post. Is there a way to post without using passport? Please tell me if so :)

What types of configuration (XML configuration file, Environment variable, etc) do your packages use?|||This is a known issue when you edit the package "standalone",
i.e. without creating the SSIS project. A workaround is to create
the project, add the package to the project, and then edit
the configuration.

We plan to fix this issue for SP1 (it was reported too late to
consider changing this for RTM release).

Thanks,
Michael.|||(Sorry, I have to wade through a lot of script errors and bad passport certificate errors to be able to post to this forum.)
The configuration involved is an environment variable pointing at an XML config file.
The package is in a project in a solution.
However, the solution has two packages, one of which calls the other.
Because of the bug that Execute SSIS task cannot handle relative paths, we have to use a mapped drive to call the package, so the target package is called via a mapped drive fully qualified file path.
I've since discovered that the bug here is that if the package is opened from the mapped drive, even though it is the same file, the Package Configuration Wizard will give this mscorlib error. The workaround for this bug is to be careful and be sure to first close the package, then open it by double-clicking it in the solution, when you need to examine or edit package configurations.
Of course, I hope this bug gets fixed, but truly, it is not nearly as bad as the bug that relative paths get wrecked and fail in the Execute SSIS task.
|||I see - this indeed seems like a different bug.
Could you please open a bug on betaplace?|||re: bug on betaplace
I invested some time trying to get into betaplace, which involved waving my cursor around to find an invisible button I had to click, and then getting to a page which said I would be granted access at some point. I tried several times on successive days, but I never got further than that. I posted my travails several times to the newsgroup, but noone had any suggestions, so I finally gave it up as something that only costs me time, and brought no benefit to anyone (as I was never able to get to a point of actually accessing any information, much less posting new bugs).
Could you open the bug on betaplace? I have a suspicion that it probably works much better for people working at Microsoft :)

|||OK, I'll open a bug directly in our bug tracking system.|||Hi,
I know its probably to late for you ( Perry_Rapp )
but
for other who trying to find solution to the "The path is not of a legal form" problem here it is:

1. open a new project/solution
2. copy the old project\s to the new "solution folder"
3. add the old project\s to the new solution from the new "solution folder".
(right click on "solution" -> Add -> Existing Project... )

Note:
if you have virtual folders in your solution first add the old project\s to the new solution root and after saving .. create the virtual folders

Configuration failing: The path is not of a legal form.

When I push Add in the configuration dialog, I cannot even get to the first page of the configuration wizard, due to the following error, in several solutions (but not in several others). All have at least one existing configuration (necessarily, to get passwords for connections).
**
An error occurred while a new configuration was being added.
Additional Information:
The path is not of a legal form. (mscorlib)

**

PS: How have the rest of you been posting? Passport hasn't been working much this week, so I've been unable to post. Is there a way to post without using passport? Please tell me if so :)

What types of configuration (XML configuration file, Environment variable, etc) do your packages use?|||This is a known issue when you edit the package "standalone",
i.e. without creating the SSIS project. A workaround is to create
the project, add the package to the project, and then edit
the configuration.

We plan to fix this issue for SP1 (it was reported too late to
consider changing this for RTM release).

Thanks,
Michael.|||(Sorry, I have to wade through a lot of script errors and bad passport certificate errors to be able to post to this forum.)
The configuration involved is an environment variable pointing at an XML config file.
The package is in a project in a solution.
However, the solution has two packages, one of which calls the other.
Because of the bug that Execute SSIS task cannot handle relative paths, we have to use a mapped drive to call the package, so the target package is called via a mapped drive fully qualified file path.
I've since discovered that the bug here is that if the package is opened from the mapped drive, even though it is the same file, the Package Configuration Wizard will give this mscorlib error. The workaround for this bug is to be careful and be sure to first close the package, then open it by double-clicking it in the solution, when you need to examine or edit package configurations.
Of course, I hope this bug gets fixed, but truly, it is not nearly as bad as the bug that relative paths get wrecked and fail in the Execute SSIS task.
|||I see - this indeed seems like a different bug.
Could you please open a bug on betaplace?|||re: bug on betaplace
I invested some time trying to get into betaplace, which involved waving my cursor around to find an invisible button I had to click, and then getting to a page which said I would be granted access at some point. I tried several times on successive days, but I never got further than that. I posted my travails several times to the newsgroup, but noone had any suggestions, so I finally gave it up as something that only costs me time, and brought no benefit to anyone (as I was never able to get to a point of actually accessing any information, much less posting new bugs).
Could you open the bug on betaplace? I have a suspicion that it probably works much better for people working at Microsoft :)

|||OK, I'll open a bug directly in our bug tracking system.|||Hi,
I know its probably to late for you ( Perry_Rapp )
but
for other who trying to find solution to the "The path is not of a legal form" problem here it is:

1. open a new project/solution
2. copy the old project\s to the new "solution folder"
3. add the old project\s to the new solution from the new "solution folder".
(right click on "solution" -> Add -> Existing Project... )

Note:
if you have virtual folders in your solution first add the old project\s to the new solution root and after saving .. create the virtual folders

Configuration failing: The path is not of a legal form.

When I push Add in the configuration dialog, I cannot even get to the first page of the configuration wizard, due to the following error, in several solutions (but not in several others). All have at least one existing configuration (necessarily, to get passwords for connections).
**
An error occurred while a new configuration was being added.
Additional Information:
The path is not of a legal form. (mscorlib)

**

PS: How have the rest of you been posting? Passport hasn't been working much this week, so I've been unable to post. Is there a way to post without using passport? Please tell me if so :)
What types of configuration (XML configuration file, Environment variable, etc) do your packages use?|||This is a known issue when you edit the package "standalone",
i.e. without creating the SSIS project. A workaround is to create
the project, add the package to the project, and then edit
the configuration.

We plan to fix this issue for SP1 (it was reported too late to
consider changing this for RTM release).

Thanks,
Michael.|||(Sorry, I have to wade through a lot of script errors and bad passport certificate errors to be able to post to this forum.)
The configuration involved is an environment variable pointing at an XML config file.
The package is in a project in a solution.
However, the solution has two packages, one of which calls the other.
Because of the bug that Execute SSIS task cannot handle relative paths, we have to use a mapped drive to call the package, so the target package is called via a mapped drive fully qualified file path.
I've since discovered that the bug here is that if the package is opened from the mapped drive, even though it is the same file, the Package Configuration Wizard will give this mscorlib error. The workaround for this bug is to be careful and be sure to first close the package, then open it by double-clicking it in the solution, when you need to examine or edit package configurations.
Of course, I hope this bug gets fixed, but truly, it is not nearly as bad as the bug that relative paths get wrecked and fail in the Execute SSIS task.
|||I see - this indeed seems like a different bug.
Could you please open a bug on betaplace?|||re: bug on betaplace
I invested some time trying to get into betaplace, which involved waving my cursor around to find an invisible button I had to click, and then getting to a page which said I would be granted access at some point. I tried several times on successive days, but I never got further than that. I posted my travails several times to the newsgroup, but noone had any suggestions, so I finally gave it up as something that only costs me time, and brought no benefit to anyone (as I was never able to get to a point of actually accessing any information, much less posting new bugs).
Could you open the bug on betaplace? I have a suspicion that it probably works much better for people working at Microsoft :)
|||OK, I'll open a bug directly in our bug tracking system.|||Hi,
I know its probably to late for you (

Perry_Rapp )
but
for other who trying to find solution to the "The path is not of a legal form" problem here it is:

1. open a new project/solution
2. copy the old project\s to the new "solution folder"
3. add the old project\s to the new solution from the new "solution folder".
(right click on "solution" -> Add -> Existing Project... )

Note:
if you have virtual folders in your solution first add the old project\s to the new solution root and after saving .. create the virtual folders
sqlsql

Tuesday, March 20, 2012

Conditionally Expand a Table

I have a form that has a table in the center with text boxes above and below
where the table may contain 1 to n number of rows. When the table has 4 or
more rows the page looks well balanced but anything less makes it look too
compressed.
I would like to conditionally add some blank table rows and have been
attempting this by adding rows and setting the visibility property using
RowCount(). Problem is I have 2 groups in this table so have separate row
counts. I did a test and added RowCount() to a text box in the table header
and it shows the total for the entire table. Is there a syntax for RowCount
that will allow me to reference the header RowCount from each of the group
row visibility properties?
Or is there a better way to set a minimum table size?
Thankstry putting your items inside of a rectangle as a group - I think your table
will expand and contract within the bounds of the rectangle and keep your
text boxed on either side too.
"Mike Harbinger" wrote:
> I have a form that has a table in the center with text boxes above and below
> where the table may contain 1 to n number of rows. When the table has 4 or
> more rows the page looks well balanced but anything less makes it look too
> compressed.
> I would like to conditionally add some blank table rows and have been
> attempting this by adding rows and setting the visibility property using
> RowCount(). Problem is I have 2 groups in this table so have separate row
> counts. I did a test and added RowCount() to a text box in the table header
> and it shows the total for the entire table. Is there a syntax for RowCount
> that will allow me to reference the header RowCount from each of the group
> row visibility properties?
> Or is there a better way to set a minimum table size?
> Thanks
>
>

Conditional Where Clause

Hi - I am writing a C# program using SQL Server. The form I have is
collecting search criteria for a database. The main 3 fields are Category,
Type, Author.
Any combination of the 3 fields can be used. That is, All 3 fields can be
used to search on, or just 2 or just 1. If the user selects 1 or 2 fields,
I
can't use the 3rd field in the where clause of the query.
How can I create a generic query and pass a string for the "where" clause
instead of creating 7 specific queries for each possible combination of
search criteria.
Thanks,
SarahCREATE PROCEDURE getbook
@.category VARCHAR(10) = NULL,
@.bookType VARCHAR(10) = NULL,
@.author VARCHAR(10) = NULL
AS
SELECT category,
booktype,
author
FROM book
WHERE (category = @.category OR @.category IS NULL )
AND (booktype = @.bookType OR @.bookType IS NULL )
AND (author = @.author OR @.author IS NULL )|||Sarah,
From what you say is the following correct:
You want a Stored Procedure that takes 3 parameters and returns a recordset
based on the passed parameters.
The SELECT statement itself will be static, and both the first two params
will be used if present, and the third [arameter will only be used if neithe
r
of the first two params are present.
Does that sum it up?
Tony
"Sarah Sarah" wrote:

> Hi - I am writing a C# program using SQL Server. The form I have is
> collecting search criteria for a database. The main 3 fields are Category
,
> Type, Author.
> Any combination of the 3 fields can be used. That is, All 3 fields can b
e
> used to search on, or just 2 or just 1. If the user selects 1 or 2 fields
, I
> can't use the 3rd field in the where clause of the query.
> How can I create a generic query and pass a string for the "where" clause
> instead of creating 7 specific queries for each possible combination of
> search criteria.
> Thanks,
> Sarah|||Sarah,
Bearing in mind the mutual exclusivity between params 1,2 and param 3, the
following code will work:::
CREATE STORED PROCEDURE [dbo].[usp_GetSearchResults]
@.Category varchar(100)='',
@.Type varchar(100)='',
@.Author varchar(100)
AS
DECLARE @.sSQL varchar(2000)
SET @.sSQL = ''
IF @.Category ='' AND @.Type =''
BEGIN
SET @.sSQL = @.sSQL + ' SELECT Category, Type, Author '
SET @.sSQL = @.sSQL + ' FROM tblMYTABLE '
SET @.sSQL = @.sSQL + ' WHERE (@.Category='' OR Category=' + CHAR(39) +
@.Category + CHAR(39) + ') '
SET @.sSQL = @.sSQL + ' AND (@.Author ='' OR Author=' + CHAR(39) + @.Author +
CHAR(39) + ') '
END
ELSE
BEGIN
SET @.sSQL = @.sSQL + ' SELECT Category, Type, Author '
SET @.sSQL = @.sSQL + ' FROM tblMYTABLE '
SET @.sSQL = @.sSQL + ' WHERE (@.Category='' OR Category=' + CHAR(39) +
@.Category + CHAR(39) + ') '
SET @.sSQL = @.sSQL + ' AND (@.Type ='' OR Type=' + CHAR(39) + @.Type +
CHAR(39) + ') '
END
EXEC (@.sSQL)
You do not necessarily need the character string to create the select
statement, it does help with debugging though.
Hope it helps,
Tony
"Sarah Sarah" wrote:

> Hi - I am writing a C# program using SQL Server. The form I have is
> collecting search criteria for a database. The main 3 fields are Category
,
> Type, Author.
> Any combination of the 3 fields can be used. That is, All 3 fields can b
e
> used to search on, or just 2 or just 1. If the user selects 1 or 2 fields
, I
> can't use the 3rd field in the where clause of the query.
> How can I create a generic query and pass a string for the "where" clause
> instead of creating 7 specific queries for each possible combination of
> search criteria.
> Thanks,
> Sarah|||KenJ - thanks - this logic will work, but I am getting a syntax error:
"Duplicated parameter names are not allowed"
when I try to do this in Query builder. Any idea what would cause this erro
r.
Thanks,
Sarah
"KenJ" wrote:

> CREATE PROCEDURE getbook
> @.category VARCHAR(10) = NULL,
> @.bookType VARCHAR(10) = NULL,
> @.author VARCHAR(10) = NULL
> AS
> SELECT category,
> booktype,
> author
> FROM book
> WHERE (category = @.category OR @.category IS NULL )
> AND (booktype = @.bookType OR @.bookType IS NULL )
> AND (author = @.author OR @.author IS NULL )
>|||I'm not familiar with query builder. Can you run it in query analyzer?
Here is a sample script that creates a table, loads some dummy data,
runs the procedure with several variations then drops the table and
procedure. I've run it in query analyzer to be sure it works...
USE tempdb
GO
SET nocount ON
GO
CREATE TABLE book (
bookid INT IDENTITY( 1 , 1 ) NOT NULL PRIMARY KEY
, category VARCHAR(10) NULL
, booktype VARCHAR(10) NULL
, author VARCHAR(10) NULL)
GO
INSERT book
VALUES('fiction'
, 'paperback'
, 'twain')
INSERT book
VALUES('fiction'
, 'hardbound'
, 'asimov')
INSERT book
VALUES('fiction'
, 'paperback'
, 'rand')
GO
CREATE PROCEDURE getbook
@.category VARCHAR(10) = NULL
, @.bookType VARCHAR(10) = NULL
, @.author VARCHAR(10) = NULL
AS
SELECT category
, booktype
, author
FROM book
WHERE (category = @.category
OR @.category IS NULL )
AND (booktype = @.bookType
OR @.bookType IS NULL )
AND (author = @.author
OR @.author IS NULL )
GO
-- get all fiction books
EXEC getbook @.category = 'fiction'
-- all fiction books by rand
EXEC getbook @.category = 'fiction' ,
@.author = 'rand'
-- all paperbacks
EXEC getbook @.bookType = 'paperback'
-- returns all books since we don't supply any filter
EXEC getbook
GO
DROP TABLE book
GO
DROP PROCEDURE getbook
GO|||On Wed, 1 Feb 2006 16:50:27 -0800, Sarah Sarah wrote:

>Hi - I am writing a C# program using SQL Server. The form I have is
>collecting search criteria for a database. The main 3 fields are Category,
>Type, Author.
>Any combination of the 3 fields can be used. That is, All 3 fields can be
>used to search on, or just 2 or just 1. If the user selects 1 or 2 fields,
I
>can't use the 3rd field in the where clause of the query.
>How can I create a generic query and pass a string for the "where" clause
>instead of creating 7 specific queries for each possible combination of
>search criteria.
Hi Sarah,
Many ways to skin this cat can be found i Erland Sommarskog's article:
http://www.sommarskog.se/dyn-search.html
Hugo Kornelis, SQL Server MVP|||Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, data types, etc. in
your schema are. Sample data is also a good idea, along with clear
specifications. It is very hard to debug code when you do not let us
see it.
It would also help if you would learn that a field and a column nothing
whatsoever alike and that names like "type", "category", etc. are too
vague to be data element names/. Try something like this:
CREATE PROCEDURE GetBook
(@.my_book_category VARCHAR(10) = NULL, -- wild guess
@.my_book_type INTEGER = NULL, -- Dewey Decimal ?
@.my_author_name VARCHAR(25) = NULL)
AS
SELECT book_category, book_type, author_name
FROM Library
WHERE book_category = COALESCE (@.my_book_category, book_category)
AND book_type = COALESCE (@.my_book_type, book_type)
AND author_name = COALESCE (@.my_author_name, author_)name) ;|||> WHERE book_category = COALESCE (@.my_book_category, book_category)
> AND book_type = COALESCE (@.my_book_type, book_type)
> AND author_name = COALESCE (@.my_author_name, author_)name) ;
That would give a tablescan.
Can you imagine how badly that will perform on a table with a few million
rows perhaps 1GB in size.
To do the tablescan everytime a user ran the query SQL Server would have to
read 1GB of data.
Now, multiply that by 10 users, thats 10GB of data SQL Server now needs to
read in order to process all 10 queries.
You are going to need one hell of a big box!
The correct way to do this is to either use IF..ELSE to make the query more
specific depending on which parameters are specified, ie. only put the
parameters specified on the WHERE clause.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"--CELKO--" <jcelko212@.earthlink.net> wrote in message
news:1138944895.900338.14850@.g47g2000cwa.googlegroups.com...
> Please post DDL, so that people do not have to guess what the keys,
> constraints, Declarative Referential Integrity, data types, etc. in
> your schema are. Sample data is also a good idea, along with clear
> specifications. It is very hard to debug code when you do not let us
> see it.
> It would also help if you would learn that a field and a column nothing
> whatsoever alike and that names like "type", "category", etc. are too
> vague to be data element names/. Try something like this:
> CREATE PROCEDURE GetBook
> (@.my_book_category VARCHAR(10) = NULL, -- wild guess
> @.my_book_type INTEGER = NULL, -- Dewey Decimal ?
> @.my_author_name VARCHAR(25) = NULL)
> AS
> SELECT book_category, book_type, author_name
> FROM Library
> WHERE book_category = COALESCE (@.my_book_category, book_category)
> AND book_type = COALESCE (@.my_book_type, book_type)
> AND author_name = COALESCE (@.my_author_name, author_)name) ;
>|||Don't forget Ken that the query below will give you a very general plan so
you'll probably end up doing a table scan.
Check the plan before you decided on the solution.
Much better to use IF ELSE or dynamic SQL and taylor your query to the
parameters passed.
Tony.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"KenJ" <kenjohnson@.hotmail.com> wrote in message
news:1138899994.839100.3010@.o13g2000cwo.googlegroups.com...
> I'm not familiar with query builder. Can you run it in query analyzer?
> Here is a sample script that creates a table, loads some dummy data,
> runs the procedure with several variations then drops the table and
> procedure. I've run it in query analyzer to be sure it works...
> USE tempdb
> GO
> SET nocount ON
> GO
> CREATE TABLE book (
> bookid INT IDENTITY( 1 , 1 ) NOT NULL PRIMARY KEY
> , category VARCHAR(10) NULL
> , booktype VARCHAR(10) NULL
> , author VARCHAR(10) NULL)
> GO
> INSERT book
> VALUES('fiction'
> , 'paperback'
> , 'twain')
> INSERT book
> VALUES('fiction'
> , 'hardbound'
> , 'asimov')
> INSERT book
> VALUES('fiction'
> , 'paperback'
> , 'rand')
> GO
> CREATE PROCEDURE getbook
> @.category VARCHAR(10) = NULL
> , @.bookType VARCHAR(10) = NULL
> , @.author VARCHAR(10) = NULL
> AS
> SELECT category
> , booktype
> , author
> FROM book
> WHERE (category = @.category
> OR @.category IS NULL )
> AND (booktype = @.bookType
> OR @.bookType IS NULL )
> AND (author = @.author
> OR @.author IS NULL )
> GO
> -- get all fiction books
> EXEC getbook @.category = 'fiction'
> -- all fiction books by rand
> EXEC getbook @.category = 'fiction' ,
> @.author = 'rand'
> -- all paperbacks
> EXEC getbook @.bookType = 'paperback'
> -- returns all books since we don't supply any filter
> EXEC getbook
> GO
> DROP TABLE book
> GO
> DROP PROCEDURE getbook
> GO
>

Friday, February 24, 2012

Condition (if / else) in SQL?

Hi all,

I'm building a DataSet on Visual Studio and don't know how to do a condition (if/else) with SQL...

I have a search form, with a DropDownList and have 2 options in it: Search by Title or Search by Author. If the "Title" is selected, then the value is "title and if "Author" is selected, then the value is "author".

Here is what I have right now for the DataSet, as seperated queries but I think I can combine them to be one single query

1.This will returns the songs that matches the title:

SELECT LYRICS_PK, LYRICS_TITLE, LYRICS_TITLE2, LYRICS_WRITER, LYRICS_WRITER2, LYRICS_COWRITER, LYRICS_DATE_ADDED, UserId_FK,
LYRICS_APPROVED, LYRICS_TYPE, LYRICS_VIEWS, LYRICS_ADDED_BY
FROM t_lyrics

WHERE ((@.LYRICS_TITLE IS NULL) OR (LYRICS_TITLE LIKE '%' + @.LYRICS_TITLE + '%') OR (LYRICS_TITLE2 LIKE '%' + @.LYRICS_TITLE + '%')) AND (@.LYRICS_TYPE = 'title')

2. This returns the songs that matches the author:

SELECT LYRICS_PK, LYRICS_TITLE, LYRICS_TITLE2, LYRICS_WRITER,LYRICS_WRITER2, LYRICS_COWRITER, LYRICS_DATE_ADDED, UserId_FK,
LYRICS_APPROVED, LYRICS_TYPE, LYRICS_VIEWS, LYRICS_ADDED_BY
FROM t_lyrics

WHERE ((@.LYRICS_AUTHOR IS NULL) OR (LYRICS_AUTHOR LIKE '%' +@.LYRICS_AUTHOR + '%') OR (LYRICS_AUTHOR2 LIKE '%' + @.LYRICS_AUTHOR + '%'))AND (@.LYRICS_TYPE = 'author')

This is very inefficient because I have 2 queries, and I need to build 2 ObjectDataSources as well as 2 different GridViews to display the results. I think we can do something like

SELECT ... ...

FROM t_lyrics

if (@.LYRICS_TYPE = 'title')

DO THE WHERE CLAUSE THAT RETURNS MATCHES WITH TITLE

else if (@.LYRICS_TYPE = 'author')

DO THE WHERE CLAUSE THAT RETURNS MATCHES WITH AUTHOR

But I don't know how to write that in T-SQL.

Any help would be greatly appreciated,

Thank you very much,

Kenny.

Example of a simple sp with if else, you can tune your queries in that line i guess:

ifexists (select *fromsysobjectswhere id =object_id ('sp_test'))drop proceduresp_testgocreate proceduresp_test@.typevarchar(1)asif (@.type ='A')beginprint'A was the entered type'returnend elsebeginprint'something else was the type'returnend
|||

Does anyone know how to write it in the query and not as SP?

Thank you very much,

Kenny.

|||

You can use SQL case statements for conditional clauses, too...
http://www.4guysfromrolla.com/webtech/102704-1.shtml

|||

Does anyone know how to write it in the query and not as SP?

if (@.type ='A')beginprint'A was the entered type'returnend elsebeginprint'something else was the type'returnend