How To Remove Item From A Solution

May 19, 2007

I added something by mistake!  If I delete it it gives me an `are you sure?` message that makes me think it'll actually delete the file from the hard drive. As I've accidentally added something from SQL Server (I was trying to add a database and got carried away) I don't think that's such a good idea.  I've googled and found this:
http://msdn2.microsoft.com/en-us/library/1ee8zw5t(VS.80).aspx
 
which helpfully states:
----- To remove a solution item
In Solution Explorer, select the item you want to remove.
On the Edit menu, choose Remove.
-----  
which would be great, if only the Edit menu had a remove option.
 
Any ideas? 

View 2 Replies


ADVERTISEMENT

Create A Query Where Semi Item Materials Are Also Listed In Finished Item Recipe?

Dec 6, 2013

I have a BOM table with all finished item receipes and semi items recipes. create a query where semi item materials are also listed in finished item recipe.

View 5 Replies View Related

Help, Running A Control Flow Item Does Not Kick Off The Next Item

Mar 6, 2007

Hi,

Here's my problem. I have 2 tasks defined in my Control Flow tab:

EXECUTE SQL--------->EXECUTE DTS 2000 PACKAGE

When I attempt to run it, by right-clicking the EXECUTE SQL task, and selecting "Execute Task", it only runs the EXECUTE SQL part (successfully), and does not "kick off" the EXECUTE DTS 2000 PACKAGE, after it is done running (even though it completes successfully, as shown by the green box).

Yes, they are connected by a dark green arrow, as indicated in my diagram above.

Why is this?? Am I missing something here? Need help.

THANKS

View 3 Replies View Related

How To Select The Last Identical Item# Until A Different Item# In The Table

Jul 12, 2007

Hello,Basically, I have a table with 2 fieldsId     item#1      33332      33333      22224      22225      22226      33337      33338      3333I would like to only select the last identical Item# which in this case would be  the id 6,7 and 8Any idea how could I do that?Thanks

View 1 Replies View Related

How Can I Create A New Custom Report Item? The Report Item Is Extends Matrix.

Jan 18, 2007

hi everyone

what the matrix's class name ?

where is the matrix's dll?

Can i create a new class extends the matrix?

I want to override the matrix's onpaint method.

Can i do this ?

why the table not have the column group?













View 9 Replies View Related

SOLUTION! - VB.NET 2005 Express And SQL Server 2005 - NOT Saving Updates To DB - SOLUTION!

Nov 30, 2006

VB.NET 2005 Express and SQL Server 2005 Express - NOT saving updates to DB - SOLUTION!

-----------------------------------

The following article is bogus and confusing:

How to: Manage Local Data Files - Setting 'Copy to Output Directory' to 'Do not copy'
http://msdn2.microsoft.com/en-us/library/ms246989.aspx

You must manually copy the database file to the output directory
AFTER setting 'Copy to Output Directory' to 'Do not copy'.

Do not copy








The file is never copied or overwritten by the project system. Because your application creates a dynamic connection string that points to the database file in the output directory, this setting only works for local database files when you manually copy the file yourself.

You must manually copy the database file to the output directory
AFTER setting 'Copy to Output Directory' to 'Do not copy'.

-----------------------------------

The above article is bogus and confusing.

This is rediculous!

This is the most vague and convoluted bunch of nonsince I've ever come accross!

Getting caught out on this issue for the 10th time!
And not being able to find an exact step-by-step solution.

--------------------------

I've tried it and it doesn't work for me.

Please don't try what the article eludes to as I'm still sorting out exactly what is supposed to be happening.



If you have a step-by-step procedure that can be reproduced this properly please PM me.

I would like to test its validity then update this exact post as a solution rather than just another dicussion thread.

Many thanks.



This is the exact procedure I have come up with:

NOTE 1: DO NOT allow VB.net to copy the database into its folders/directorys.

NOTE 2: DO NOT hand copy the database to a folder/directory in your project.

Yes, I know its hard not to do it because you want your project nice and tidy.
I just simply could NOT get it to work.
You should NOT have myData.mdf listed in the Solution Explorer. Ever.

Create a folder for your data following NOTE 2.

Copy your data to that folder. * mine was C:mydatamyData.mdf



Create a NEW project.

Remove any Data Connections. ( no matter what)

Save it.

Data | View Data Sources

Add New Data Source

select NEW CONNECTION ( No Matter what, do it!

Select the database. * again mine was C:mydatamyData.mdf

Answer NO to the question:
Would you like to copy the file to your project and modify the connection?
- NO ( no matter what - ANSWER NO ! - Absolutely NO )
Then select the tables you want in the DataSet.
and Finish.



To Test ----------

From the Solution Explorer | click the table name drop down arrow | select details
Now Drag the table name onto the form.

The form is then populated with a Navigation control
and matching Labels with corresponding Textboxes for each field in the table.

Save it.

1) Run the app.

Add one database record to the database by pressing the Add(+) icon

Just add some quick junk data that you don't mind getting lost if it doesn't save.

YOU MUST CLICK THE SAVE ICON to save the data you just entered.

Now exit the application.

2) Run the app again.

And verify there is one record already there.

Now add a second database record to the database by pressing the Add (+) icon.

NOW add some quick junk data that you WILL intentionally loose.

*** DO NOT *** press the save icon.

Just Exit the app.

3) Again, Run the app.

Verify that the first record is still there.

Verify that the Second record is NOT there.
Its NOT there because you didn't save the data before exiting the app.

Proving that YOU MUST CLICK THE SAVE ICON to save the data you just entered.

Also proving you must add your own code to catch the changes
and ask the user to save the data before exitiing or moving to another record.

As a side note, since vb.net uses detached datasets,
(a copy/snapshot of the dataset in memory and NOT directly linked to the database)
the dataset will reflect all changes made when moving around the detached datasets.
YOU MUT REMEMBER TO SUBMIT YOUR CHANGES TO THE DATABASE TO SAVE THEM.
Otherwise, they will simply be discarded without notice.

Whewh!

I hope this saves me some time the next time I want to start a new database project.

Oh, and uh, for anyone else reading this post.

Thanks,
Barry G. Sumpter

Currently working with:
Visual Basic 2005 Express
SQL Server 2005 Express

Developing Windows Forms with
101 Samples for Visual Basic 2005
using the DataGridView thru code
and every development wizard I can find within vb.net
unless otherwise individually stated within a thread.

View 17 Replies View Related

SQL Server Management Studio: Can Not Remove AdventureWorksDB In Add Or Remove Programs Of Control Panel

Nov 30, 2006

Hi all,

I tried to remove AdventureWorksDB in the "Add or Remove Programs" of Contol Panel and I got the following errors: (1) AdventureWorksDB     Error 1326: Error getting file security: CProgram FilesMicrosoft SQL ServerMSSQL1MSSQLGetLastError: 5.      |OK|   and (2) Add or Remove Programs   Fatal Error during installation (after I clicked the |OK| button).   Please help and tell me how I can solve this problem.

Thanks in advance,

Scott  Chang 

View 1 Replies View Related

Finding Orders That Have At Least 1 Promo Item And 1 Non-promo Item

Oct 16, 2014

I am having trouble finishing the last bit of a report. The report shows orders that customers have placed that contain 0 promo items, All promo items (all items in order are promo items), and a mix of promo and non promo (at least 1 promo item and 1 non-promo item). Ive simplified this a bit for ease of understanding but lets assume we have 2 tables: A Promo table that contains the items on promotion and the dates that promotion is valid, and a Sales table, that contains the order number, order date, and sku ordered.

I've already written code that finds orders that have at least 1 promo item in them, and using that, I can determine what orders have 0 promo items in them. Where I am stuck is taking the orders that have at least 1 promo item in them, and separating them into orders that have only promo items, and those that have both promo and not promo items in them. Also, there are several promos throughout the year (called "Offers") so in my code below, you can see 2 different Offers ("JF" and "MA") with their corresponding dates they are valid. They will never overlap. My results also have to be split out by Offer so management can look at the results of each offer separately. Here is some code:

Code:
create table #Promos (
Offer varchar(2) null,
SKU int null,
StartDt date null,
EndDt date null

[Code] ....

So my results should show OrderNo A1111 in the Promo and No Promo group because of SKU 5 not being promotional during the time that order was placed. OrderNo A2222 should be in the Promo Only group because both SKUs on the order were promotional at the time the order was placed.

View 6 Replies View Related

How Do I Clean Up The SQL Server (ctp) From ADD/REMOVE Program Without The Change/remove Button

Oct 12, 2006

I have uninstalled the CTP version of the SQL Server express so that I can install the released version but CTP version is still listed in the add/remove program list but without the change/remove button. I have been to different sites to find information on cleaning this up and I have ran all the uninstall tool I can find but the problem still prevails. I cannot install the released version without completely getting rid of the CTP version. Please help anyone.

Thanks

deebeez1

View 1 Replies View Related

Unable To Remove SQL Instance In Add/Remove Program

Mar 8, 2007

I need help,

I am having a hard time removing my SQL instance inside the Add/Remove program. After i select the SQL Instance name and then I tried to remove it but it won't allow me to delete it. There isn't any error message or whatsoever. Actually, when i try to log it in my SQL Management studio, that certain sql instance name is not existing according to the message box. Is there any way to remove the Sql Instance in my system?

I appreciate your help, Thanks

IS Support

View 1 Replies View Related

Item

Jan 12, 2005

I want read
dr[2] = SqlDataReader dr1.item("lastmane");
from database
but I have error expected
I don't while


SqlDataReader dr1 = cmd.ExecuteReader();
dr1.Read();

dr[2] = SqlDataReader dr1.item("lastmane");

View 2 Replies View Related

Need Sum Of A Particular Item

Apr 23, 2008

select i.a,
w.c,
w.e
from table1 i,table2 w where
i.a=w.a (Here c is the primary key for each a)-iam getting o/p like this

a c e

aaa x 2
aaa y 10
bbb y 5
ccc x 3
ccc y 4

i need o/p in this way (ie sum of e for each a)
a e
aaa 12
bbb 5
ccc 7

Is it possible

Thanx

View 1 Replies View Related

Get Item Name Instead Of ID

Jan 11, 2014

I´m trying to get a query where I´ll get an answer like this:

+--------------+----------------+----------------+------------------+-----------------+
| champion_id | champion_name | champion_item1 | champion_item... | champion_item16 |
+--------------+----------------+----------------+------------------+-----------------+
| 1 | Legolas | boots | ... | sword |
+--------------+----------------+----------------+------------------+-----------------+

This is the scenario how I set up my tables (let me know if I should change it):

table champions

+--------------+----------------+
|champion_id | champion_name |
+--------------+----------------+
| 1 | Legolas |
+--------------+----------------+

table equipment

+--------------+----------------+------------------+-----------------+
| champion_id | champion_item1 | champion_item... | champion_item16 |
+--------------+----------------+------------------+-----------------+
| 1 | 5 | ... | 22 |
+--------------+----------------+------------------+-----------------+

table items

+--------------+----------------+
| item_id | item_name |
+--------------+----------------+
| 5 | boots |
+--------------+----------------+
| 22 | sword |
+--------------+----------------+

But I still don´t know how to call the equipment table and get champion name and item names for the numbers. What did I do wrong and how can I fix it?

The foreign keys are in place.

View 5 Replies View Related

How To Get The Last Item Added

Dec 14, 2004

Not 100% sure how to do this so I would appreciate some directions. I have 2 tables, Systems and Contacts. A system can have 1 to infinite contacts and contact can have 1 to infinite systems. So I use a 3rd table Sys_Con to add the contact needed for each system.
Now my question is once I add the System and contact how do I know for sure which ContactID to add in my Sys_Con table? Because while I am doing this operation maybe someone can add an other contact. So is there a way for my store proc Add_Contact to return the contactID needed for my store proc Add_Sys_Con ?

TABLE Sys_Con
SystemID int
ContactID int

Table Contact
ContactID int Identity
ContactName
...

Table System
SystemID
...

View 3 Replies View Related

Get Only ONE Row Per Item With Different Fields

Nov 25, 2007

Hi,

I'm a bit stuck here.
I have a table called STM_COMM and it contains following fields: id, member_id, email_addr, tel_nr, fax_nr

A member can have multiple email addresses, telephone numbers and faxnumbers. so we could have something like this:

id member_id email_addr tel_nr fax_nr
-------------------------------------------------------
1 5 info@test.com
2 5 555687 568774
3 66 test@go.nl 65897854
4 5 another@one.com

What I would like to have is only ONE (1) row PER member with only the FIRST (not max!) entered known data. In the above case, I'd like to have this as result:

member_id email_addr tel_nr fax_nr
----------------------------------------------------
5 info@test.com 555687 568774
66 test@go.nl 65897854

I've tried lots of things (max, inner select ...) but I can't seem to figure it out.

Thank you for the help !

Christophe

PS: I'm working on a sql server 2005

View 1 Replies View Related

Get Value Of Last Item In Column?

Mar 7, 2007

How can I get the value of the last Item in a coums?SELECT COLUMN FROM DATABASE ORDER BY COLUMN DESC?something with Fields(0).value?Thank you in advance

View 4 Replies View Related

No Item Showed

Feb 27, 2007

Hi gurus

I have sql server 2000 that was working fine until today(figures), today I opened EM and under sql server group where used to be all my information now there is NO ITEM, nothing shows(database,Nothing) The server is working as I had no complaints from my user on data not been saved or getting data from but its strange that I can not see all my info like I used to.- If I go into sql query analizer, it ask me to connect to local which I do and I can see all my databases from there but once I close that window ,on my EM nothing shows.

I checked all services andevery one of them seems to be up and runnig

Thanks forall the help I can get

View 4 Replies View Related

How To Get The Max Value Of Duplicate Item

Aug 8, 2007



Hi Every Body,
I have one table it's called -Access.It contains two columns name of that is Door,Emp_Id.
example Door Emp_Id
10 1
10 2
10 3
11 4
12 5
11 1
this is the value in that table.......
I want get Which Door number maximum Access from the table.....
Thanks & Regards,
S.Sajan

View 7 Replies View Related

Totals Per Item

May 2, 2007

Hi Everyone I have an ADP and I need to create a report that will give me the total number of each item. I need the report to show how many [Violation Type], and the total [Loss] per violation. Can anyone help please








Code Snippet

CREATE TABLE [dbo].[Revised_MainTable] (
[I/RDocument] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[IR Number] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Date] [datetime] NULL ,
[Inspector] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Area] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Violation] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Violation Type] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Loss] [money] NULL ,
[Loss Type] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Employee] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Guest] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Action] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Action Type] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Notes] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Security/GC] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO





View 9 Replies View Related

How Can I Add An Item Into Dataset?

Feb 28, 2008

Hi all,

I have some problem about parameter to query data. My parameter is available from dataset but it doen not have blank or null value. So when I want to select this...

SELECT *
FROM mytable
WHERE (@param_person_id IS NULL OR @param_person_id = person_id)

cannot success. This statement means "if @param_person_id has null value, this statement is select every person_id. On the other way, if @param_person_id is not null value, this statement select only specific person_id".

So I want to add blank or null value to my dataset for working with select statement.

How can I do?

Thank you very much

View 1 Replies View Related

Sum Report Item

Feb 19, 2007

Is there anyway to sum a value that resides in a textbox?

ie; =Sum(ReportItems!MyTextBox.value) ?

View 7 Replies View Related

How To Check There Is No Item In Table?

Apr 1, 2008

Hi,I want to check that Is there row exists in table or not.Please correct me.          Dim conn As SqlConnection        Dim comm As SqlCommand        Dim reader As SqlDataReader        Dim connstring As String        connstring = ConfigurationManager.ConnectionStrings("iharyana").ConnectionString        conn = New SqlConnection(connstring)        comm = New SqlCommand("select * from test where username=@username", conn)        comm.Parameters.Add("@username", Data.SqlDbType.VarChar, 20)        comm.Parameters("@username").Value = uname        conn.Open()        reader = comm.ExecuteReader        While reader.Read            If reader.Item("username").ToString = "" Then                Response.Redirect("http://www.iharyana.com")            End If                End While        reader.Close()        conn.Close()

View 1 Replies View Related

How To Count Each Staus For Same Item ?

Apr 10, 2008

I using SQL SERVER
 
just wondering which command I can use to query items status ?
 in my TABLEA
Product(D   |     Name   |      Type |     Status
1                   Apple           Fruit          00021234     
2                   Banana         Fruit         00031244    
3                    Tube            Clothe       00012131
4                     Tee             Clothe       00041111
4                     pants             Clothe       00041112
4                     tank             Clothe       00051111
4                     Jeans            Clothe       00061111
4                     Dress             Clothe       00051111
 
in TABLEB
ID  StatusID  Status
1      0001         A
2      0002         B
3      0003         C
4      0004         D
5      0005         E
6      0006         F
 use this record as a example :
ProductID   |     Name   |      Type |     Status
1                   Apple           Fruit          00021234   
 
use TableA.Status reference to TableB.StatusID  ( compare 0001 , need not to care about the last 4 numbers ) so the status is A
 
AB is Group 1
C   is Group 2
DEF is Group 3
 in my TABLEA
Product(D   |     Name   |      Type |     Status
1                   Apple           Fruit          00021234     
2                   Banana         Fruit         00031244    
3                    Tube            Clothe       00012131
4                     Tee             Clothe       00041111
4                     pants             Clothe       00041112
4                     tank             Clothe       00051111
4                     Jeans            Clothe       00061111
4                     Dress             Clothe       00051111
 
I want the result looks as follow
TYPE   Group 1    Group 2     Group 3
Fruit        1                1             0           //because  Apple           Fruit          00021234     â†’ 0002 = B → Group 1 And Banana         Fruit         00031244 →0003 =C→Group 2
Clothe     1                 0             5
 
I need to run a query to get the result like that , and then put the result to my DataGrid then show to user...
can I just use SQL Query to get the result? I just try to use like sum�Substring ... trying to get the result but I still can't wirte a query to work for this question..
which command I should use for this question? or it must be done in code-behind ?
 can you please give me help?
thank you very much

View 4 Replies View Related

How Do You Receive The Last Item In A Table

Jan 26, 2004

Thats it
How do you receive the last item(row) in a table.
Thanks

View 11 Replies View Related

Item Description In Shorthand

Jun 29, 2005

Hi,

If you browse to Amazon and drill down through categories until a paged
listing appears, you will see in each item of the listing that the
description rendered as Book Description, is a cutdown version of the
full description, with a ... and "Read More" hyperlink.  How is
this achieved programatically? I dont know if thre is an efficient way
in SQL Server to do this, or whether it would be easier to have a
ShortHand field and a Description field, both of which are teh full
description when shown in the Details page, but the ShortHand is the
field rendered in listings.  This seems like a simplistic solution
and I am thinking there may be programmatic means of doing the same -
has anybody got any experience in this area?

Thanks!

jr.

View 4 Replies View Related

Update Count With 1 On First Item. Possible?

Feb 8, 2004

Hello All.

I need your advise on this .....

I have a table with Bill_Doc, Bill_Item and Bill_Doc_Count fields. I need to update Bill_Doc_Count with 1 only on the first Bill_Item. Is this possible? I tried min and max but they don't work for me.

Please help. Thanks a million.

For example,

Bill_Doc Bill_Item Bill_Doc_Count
123 1 1
123 2 Null
123 3 Null
124 1 1
125 1 1
125 2 Null

Best regards

View 5 Replies View Related

SQL 2012 :: Add Value Of Same Item Number?

Aug 26, 2015

My data look like this:

ITEMID DESC QTY PRICE
134 ITEM1 4 $200
134 ITEM1 1 $200
134 ITEM1 1 $200

how do I write SQL stmt to add the quantity if the itemid is the same?

The result should be:

ITEMID DESC QTY PRICE
134 ITEM1 6 $200

View 2 Replies View Related

Locate Item In A Table

Aug 2, 2006

I have a sql table containing names of departments. Is there a way after a user has typed a department in a textbox on a web page I can search for it in the sql table and if it isn't there then add it. I am using asp.net for the web page.

View 3 Replies View Related

Select .... Where The Item.ID Is In This Array?

Jul 20, 2005

Hiya,I want to populate a list view (in a variety of ways), but I would rathernot execute my function once for every record I want to show in the list.What I want to do is pass an array of "keys" into a stored procedure andhave that procedure return one recordset with all of the records in. Sowhat I want to do is something like:CREATE PROCEDURE MySuperProcedure@MyArrayOfIDs (some way of specifying an array of integers),ASSELECT *FROM MyTableWHERE MyArrayOfIDs.ContainsTheInteger ( MyTable.ID )Obviously this syntax is not available. Is there another way of doing this?

View 3 Replies View Related

Last Item In A Group Footer?

Apr 14, 2008

Is there any way to know you're at the last row in a group footer? I'd like to just hide all other rows except that one...

Thanks,
Steve

View 3 Replies View Related

Add A Checkbox Report Item

Aug 24, 2006

Hi there,

I am using SQL Server 2005 Reporting Services. Right now, I have a textbox with 0 or 1 values in my report and I want to show a checkbox: checked for value 1 and uncheck for 0. Is there anyway to add a checkbox in the report?

Thanks in advance.

semaj

View 5 Replies View Related

CTE - Determine Closest Item

Aug 9, 2007

I have included the create table statements, sample data and a stored procedure.

I have a stored procedure that walks the associations so that I can assemble all the nodes of the tree. I think this is working properly.

I have two requests/needs/problems that I need to solve:
(1)
I want to create a NEW stored procedure that takes a WhoID and an AssocID.
This new stored procedure would show the shortest or closest path between WhoID and AssocID.

For example, if I pass in 6,1 to this new proc I want the stored procedure to return the hierarchy with the closest path between them. Based on the sample data below, the path would be
6 - 8
8 - 2
2 - 3
3 - 1

(2)
I might also need a proc that accepts two inputs (again, lets use 6,1) but would show all paths / branches of the tree where person 1 exists. Based on the stored procedure procCTE_Assoc 6, this solution would exclude the "fred and jeff" node but would include the other two nodes because person 1 is within the other two nodes.


Please provide your suggestions, comments, or solutions!





CREATE TABLE dbo.Who(
WhoID bigint IDENTITY(1,1) NOT NULL,
FName varchar(50) NOT NULL
)
GO
CREATE TABLE dbo.Assoc(
WhoID bigint NOT NULL,
AssocID bigint NOT NULL
) ON PRIMARY



SET IDENTITY_INSERT dbo.Who ON
GO
INSERT INTO Who (WhoID,FName) VALUES (1,'user1')
INSERT INTO Who (WhoID,FName) VALUES (2,'user2')
INSERT INTO Who (WhoID,FName) VALUES (3,'admin1')
INSERT INTO Who (WhoID,FName) VALUES (4,'admin2')
INSERT INTO Who (WhoID,FName) VALUES (5,'admin3')
INSERT INTO Who (WhoID,FName) VALUES (6,'Keith')
INSERT INTO Who (WhoID,FName) VALUES (7,'fred')
INSERT INTO Who (WhoID,FName) VALUES (8,'Joe')
INSERT INTO Who (WhoID,FName) VALUES (9,'Jack')
INSERT INTO Who (WhoID,FName) VALUES (10,'Doug')
INSERT INTO Who (WhoID,FName) VALUES (11,'Mark')
INSERT INTO Who (WhoID,FName) VALUES (12,'Al')
INSERT INTO Who (WhoID,FName) VALUES (13,'Jeff')
INSERT INTO Who (WhoID,FName) VALUES (14,'Brandon')
INSERT INTO Who (WhoID,FName) VALUES (15,'Ashley')
INSERT INTO Who (WhoID,FName) VALUES (16,'Lisa')
INSERT INTO Who (WhoID,FName) VALUES (17,'Julie')
INSERT INTO Who (WhoID,FName) VALUES (18,'Brian')
go
SET IDENTITY_INSERT dbo.Who OFF
GO
INSERT INTO Assoc (WhoID,AssocID) VALUES (1,4)
INSERT INTO Assoc (WhoID,AssocID) VALUES (2,1)
INSERT INTO Assoc (WhoID,AssocID) VALUES (2,3)
INSERT INTO Assoc (WhoID,AssocID) VALUES (6,7)
INSERT INTO Assoc (WhoID,AssocID) VALUES (6,8)
INSERT INTO Assoc (WhoID,AssocID) VALUES (7,13)
INSERT INTO Assoc (WhoID,AssocID) VALUES (8,2)
INSERT INTO Assoc (WhoID,AssocID) VALUES (14,8)
INSERT INTO Assoc (WhoID,AssocID) VALUES (6,15)
INSERT INTO Assoc (WhoID,AssocID) VALUES (15,18)
INSERT INTO Assoc (WhoID,AssocID) VALUES (15,17)
INSERT INTO Assoc (WhoID,AssocID) VALUES (17,5)
INSERT INTO Assoc (WhoID,AssocID) VALUES (5,1)



go
create proc dbo.procCTE_Assoc
@WhoID bigint
AS

WITH GroupsCTE (WhoID, AssocID, FName, FNameAssoc, Lvl, Sort, GroupWithIndent)
AS
(
-- Anchor Who definition
SELECT M.WhoID, MA.AssocID, M.FName, AssocWho.FName, 0 AS Lvl,
CONVERT(varchar(2000),AssocWho.FName) AS Sort,
CONVERT(varchar(255), AssocWho.FName)
FROM Who M
INNER JOIN Assoc MA ON M.WhoID = MA.WhoID
INNER JOIN Who AssocWho ON AssocWho.WhoID = MA.AssocID
WHERE M.WhoID = @WhoID
UNION ALL
-- Recursive Who definition
SELECT g1.WhoID, MA1.AssocID, g1.FName, g2.FName, Lvl + 1,
CONVERT(varchar(2000),RTRIM(Sort) + '|' + g2.FName),
CONVERT(varchar(255), REPLICATE ('| ' , Lvl+1) + g2.FName)
FROM Who g1
INNER JOIN Assoc MA1 ON g1.WhoID = MA1.WhoID
INNER JOIN Who g2 ON g2.WhoID = MA1.AssocID
INNER JOIN GroupsCTE CTE
ON MA1.WhoID = CTE.AssocID
)

SELECT *
FROM GroupsCTE
ORDER BY Sort

RETURN (0)
GO

exec procCTE_Assoc 6

View 5 Replies View Related

Cannot Find An Item In A Big Table

Nov 27, 2006

Hello people,

I have a table of 30,000 records on my handheld which runs windows 4.2 and sql me. When the item I am searching for is at the top of the table, the search finds it easily. When the item is in the middle or lower, it doesnt find it. I am not running out of memory and my database is on the local memory. Here is my code:



String query = "SELECT * FROM Products WHERE Barcode = " + TheReaderData.Text;

DataSet ds = GetDescription(query);

label2.Text = TheReaderData.Text;

label1.Text = "No description";

if (ds.Tables[0].Rows.Count != 0)

{

label2.Text = (ds.Tables[0].Rows[0].ItemArray[0]).ToString();

label1.Text = (ds.Tables[0].Rows[0].ItemArray[1]).ToString();

}



---------------------------------------------------------------------------------------

private DataSet GetDescription(string str)

{

DataSet ds = new DataSet();

try

{

System.Data.SqlServerCe.SqlCeEngine theEngine = new SqlCeEngine(CONN_STRING);



if (!System.IO.File.Exists(DBFILE))

{

theEngine.CreateDatabase();

}



SqlCeDataAdapter da = new SqlCeDataAdapter(str, localDB);

da.SelectCommand.CommandTimeout = 6000;

da.SelectCommand.CommandType = CommandType.Text;



da.Fill(ds);

}

catch (Exception exce)

{

string total = exce.ToString();

}

return ds;

}



I hope there is some way to find the item in the object. Any ideas?

Thanks in advance, John.

View 9 Replies View Related







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