Showing posts with label products. Show all posts
Showing posts with label products. Show all posts

Thursday, 8 March 2012

Connect 2 DropDownList and Received "Input string was not in a correct format"

I have 2 DropDownList, the first one to display the product category and the other one to display the products based on the selected category. However, when I run code I received the following error message:Input string was not in a correct format.

Please find the code below.

Thanks,

Andy.

<%@.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

<div>

<asp:DropDownListID="DropDownList1"runat="server"DataSourceID="SqlDataSource1"

DataTextField="Name"DataValueField="Name">

</asp:DropDownList>

<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:Assignment2ConnectionString %>"

SelectCommand="SELECT [Name] FROM [Category]"></asp:SqlDataSource>

<br/>

<asp:DropDownListID="DropDownList2"runat="server"DataSourceID="SqlDataSource2"

DataTextField="Name"DataValueField="Name">

</asp:DropDownList>

<asp:SqlDataSourceID="SqlDataSource2"runat="server"ConnectionString="<%$ ConnectionStrings:Assignment2ConnectionString %>"

SelectCommand="SELECT [Name] FROM [Product] WHERE ([CategoryID] = @.CategoryID2)">

<SelectParameters>

<asp:ControlParameterControlID="DropDownList1"Name="CategoryID2"PropertyName="SelectedValue"

Type="Int32"/>

</SelectParameters>

</asp:SqlDataSource>

</div>

</form>

</body>

</html>

Assume you have a categoryID field in your Category table: You add CategoryID to the SELECT statement and changeDataValueField="CategoryID" .

<asp:DropDownListID="DropDownList1"runat="server"DataSourceID="SqlDataSource1"

DataTextField="Name"DataValueField="CategoryID">

</asp:DropDownList>

<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:Assignment2ConnectionString %>"

SelectCommand="SELECT [Name],[CategoryID] FROM [Category]"></asp:SqlDataSource>

<br/>

Connect .mdf file to MSDE 2000

I'm using a product (SAP Business one) using MSDE 2000A. Another product I
receintly bought also uses SQL. According to this products manual I need to
connect the *.mdf database to my SQL server using SQL Enterprise Manager. How
does it work?
hi,
GV wrote:
> I'm using a product (SAP Business one) using MSDE 2000A. Another
> product I receintly bought also uses SQL. According to this products
> manual I need to connect the *.mdf database to my SQL server using
> SQL Enterprise Manager. How does it work?
you are required to "attach" the provided database to an existing SQL
Server/MSDE instance...
as MSDE does not provide Entrprise Manager, you have to resort on the
command line tool, oSql.exe, to execute the corresponding Transact-SQL
statement to attach the database using the system stored procedure
sp_attach_db...
you can find the full synopsis of the introduced stored procedure at
http://msdn.microsoft.com/library/de...ae-az_52oy.asp
at http://support.microsoft.com/default...;EN-US;q325003 you will
find some information on how to use oSql.exe to perform this task as long as
other related management tasks..
for your convenience, you can have a look at a free prj of mine, available
at the link following my sign., which provides a graphical user interface
similar to Enterprise Manager in order to accomplish management tasks,
including the one here discussed..
futher tools for MSDE, both commercial and free, are listed
http://www.microsoft.com/sql/msde/partners/default.asp and/or
http://www.aspfaq.com/show.asp?id=2442
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.10.0 - DbaMgr ver 0.56.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

Saturday, 25 February 2012

Confused about CONTAINS and CONTAINSTABLE

I have not been using FTS for long, so maybe I am missing an obvious
this here... I have a table with titles of products in them. Its about
a million rows. If I do:
set @.arg='("pda") and ("case")'
select stockcode, rank,
from containstable(product,*,@.arg, 1000)
order by rank desc
and
select stockcode from exp_product where contains(*,@.arg)
I get 20 results for the first and 25 for the second. If I do a
regular like query that returns 25 results. Why does the
containstable not return all the results?
The products titles are less than 100 characters and I did a full FTS
rebuild before the test (and it had finished).
Rob Chafer
Silverfrost
Hi Rob,
Could be something to do with three character searches that are
automatically excluded from the search. If you can change pda to
something longer and test, it might show different results.
I'm just trying to work around this one myself.
Ryan
|||Sorry, disregard that, I had an issue with quoting.
I notice that you are not using wildcards, are you after exact matches
only? Could you try;
set @.arg='("*pda*") and ("*case*")'
Ryan
|||Ryan
Thanks for your reply. It was actually only an example and the words
(specifically) were 'acer' and 'expansys' -- longer than 3 letters. I
did not use wildcards -- the words were in the titles and as single
words so did not use wildcards.
"Ryan" <ryano@.lightsdown.com> wrote:

> Sorry, disregard that, I had an issue with quoting.
> I notice that you are not using wildcards, are you after exact matches
> only? Could you try;
> set @.arg='("*pda*") and ("*case*")'
> Ryan
Rob Chafer
Silverfrost
|||This is abnormal. How many results does this return?
select stockcode, rank, from containstable(product,*,@.arg)
I take it you are using SQL 2000? Also what sp.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Robert Chafer" <noreply@.silverfrost.com> wrote in message
news:uefth1tj1nel2a2e45j890aokpgp6b7bk6@.4ax.com...
> I have not been using FTS for long, so maybe I am missing an obvious
> this here... I have a table with titles of products in them. Its about
> a million rows. If I do:
> set @.arg='("pda") and ("case")'
> select stockcode, rank,
> from containstable(product,*,@.arg, 1000)
> order by rank desc
> and
> select stockcode from exp_product where contains(*,@.arg)
> I get 20 results for the first and 25 for the second. If I do a
> regular like query that returns 25 results. Why does the
> containstable not return all the results?
> The products titles are less than 100 characters and I did a full FTS
> rebuild before the test (and it had finished).
> --
> Rob Chafer
> Silverfrost
|||Robert,
I can explain this... Basically, you're using two very different methods
(CONTAINSTABLE vs. CONTAINS) with the former results limited to the
Top_N_by_RANK where N is 1000. Specifically, you should review KB article
240833 "FIX: Full-Text Search Performance Improved via Support for TOP" at
http://support.microsoft.com//defaul...b;EN-US;240833 for more
details.
Basically, you're not comparing apples-to-apples... Try the below modified
code (removed 1000)
set @.arg='("pda") and ("case")'
select stockcode, rank,from containstable(product,*,@.arg) order by rank desc
-- vs.
select stockcode from exp_product where contains(*,@.arg)
Regards,
John
SQL Full Text Search Blog
http://spaces.msn.com/members/jtkane/
"Robert Chafer" <noreply@.silverfrost.com> wrote in message
news:uefth1tj1nel2a2e45j890aokpgp6b7bk6@.4ax.com...
>I have not been using FTS for long, so maybe I am missing an obvious
> this here... I have a table with titles of products in them. Its about
> a million rows. If I do:
> set @.arg='("pda") and ("case")'
> select stockcode, rank,
> from containstable(product,*,@.arg, 1000)
> order by rank desc
> and
> select stockcode from exp_product where contains(*,@.arg)
> I get 20 results for the first and 25 for the second. If I do a
> regular like query that returns 25 results. Why does the
> containstable not return all the results?
> The products titles are less than 100 characters and I did a full FTS
> rebuild before the test (and it had finished).
> --
> Rob Chafer
> Silverfrost
|||Hilary
Thank you for your help...from your example I realised what the issue
was. Although the recordset returned only has 20 and 25 rows, there
was an extra condition (to select language). Although the condition
was identical in both examples, the ,1000 in the containstable meant
that a few of the matches never made it through.
I live and learn
Thanks again.
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote:

> This is abnormal. How many results does this return?
> select stockcode, rank, from containstable(product,*,@.arg)
> I take it you are using SQL 2000? Also what sp.
Rob Chafer
Silverfrost

Conflicting Members

I have a report that includes a set, customer divisions as columns and products as rows. At certain intersections members are filtered by the same attribute (ie customer is filtered by product flag as is the product). Some of these have conflicting attribute values (ie product flag is true for the customer but false for the product). In these cases the customer setting is taking precedence. However I need the member setting for the product to override the customer. Is there a way of achieving this?

From your description it is not clear to me what your issue is. Axes are resolved independently, so there could be no conflicts in filtering customers and products. And if you refer to cell values, then what does filtering means ? It would be best if you will provide the exact MDX you are using and results you want to get, then this forum will be able to help you with MDX modifications.|||

In response to your question I am referring to cell values. My MDX query is basically SELECT [Customer Set] on Columns, [Product Set] on rows. I have members in my customer set and my product set which are filtered by the same attribute (Product Flag):

Product Member = ([Product - Own Keg Total] , [Product].[Product Flag].[TRUE])

Customer Member = ([Customer].[Customer Hierarchy - Area].[Market].&[United Kingdom].&[Tied Trade], [Customer].[Product Flag].[FALSE])

The values results returned indicate that the attribute value for the product flag of the customer member has been used.

Hope this makes it clearer. If not let me know. Thanks.

|||Can you please provide a definition of named sets [Customer Set] and [Product Set]. I am still not sure what you meant by Product Member and Customer Member in your response, but one thing contradicted what you said about same attribute (Product Flag) being used - in your tuple expression once you used attribute in the Product dimension and once in Customer dimension, so it cannot be the same attribute.|||

Sorry to add to the confusion. The customer member should have read:

([Customer].[Customer Hierarchy - Area].[Market].&[United Kingdom].&[Tied Trade], [Product].[Product Flag].[FALSE])

Ignoring sets, if I run the query with just the product member on the row and the customer member on the column I get the same result:

WITH MEMBER [Product].[Product Hierarchy].[Product Test] AS

([Product].[Product Hierarchy].[Product Group Section].&[Own Beer]&[Own Keg], [Product].[Product Flag].[True])

MEMBER [Customer].[Customer Hierarchy - Area].[Customer Test] AS

([Customer].[Customer Hierarchy - Area].[Market].&[United Kingdom].&[Tied Trade], [Product].[Product Flag].[FALSE])

SELECT

[Product Test] ON COLUMNS ,

[Customer Test] ON ROWS

FROM [beer_co]

WHERE ( [Measures].[Barrelage] )

|||

Thanks - it is clear now. The mechanism to control order of conflict resolution on calculated members is through SOLVE_ORDER property. I.e. in the following query Customer Test has higher solve order, therefore the Product Flag=True would win

WITH MEMBER [Product].[Product Hierarchy].[Product Test] AS

([Product].[Product Hierarchy].[Product Group Section].&[Own Beer]&[Own Keg], [Product].[Product Flag].[True]), SOLVE_ORDER=1

MEMBER [Customer].[Customer Hierarchy - Area].[Customer Test] AS

([Customer].[Customer Hierarchy - Area].[Market].&[United Kingdom].&[Tied Trade], [Product].[Product Flag].[FALSE]), SOLVE_ORDER=2

SELECT

[Product Test] ON COLUMNS ,

[Customer Test] ON ROWS

FROM [beer_co]

WHERE ( [Measures].[Barrelage] )

And in the following query, the SOLVE_ORDER is reversed, therefore Product Flag=False will win.

WITH MEMBER [Product].[Product Hierarchy].[Product Test] AS

([Product].[Product Hierarchy].[Product Group Section].&[Own Beer]&[Own Keg], [Product].[Product Flag].[True]), SOLVE_ORDER=2

MEMBER [Customer].[Customer Hierarchy - Area].[Customer Test] AS

([Customer].[Customer Hierarchy - Area].[Market].&[United Kingdom].&[Tied Trade], [Product].[Product Flag].[FALSE]), SOLVE_ORDER=1

SELECT

[Product Test] ON COLUMNS ,

[Customer Test] ON ROWS

FROM [beer_co]

WHERE ( [Measures].[Barrelage] )

|||Is there a way of configuring the query so that where there is a conflict neither member wins and nothing is returned?