473,499 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hurry! Query Need help.

Hello Fellow Developers,
I am very new to SQL and ASP.net and in the learning process. I have to
do a small web application that handles documents stored on a sql
database. The requirements of the functionality of the application are
below. I am just having trouble setting my query to work correctly.

Problem:
I want to be able to pull documents and folders that have the same
ClientID. However, here is the catch, the query should take two inputs
- ClientID and ParentID (which is an ID representing FolderID from the
Folder Table; the document/folder does not belong to another folder
then the system will enter ZERO as the ParentID). I hope this is
clear???

Any help is greatly appreciated, as life is a learning experience.

Database Structure:

Table Name: Client
Fields:
ClientID primary key autonumber
Name nvarchar 255

Table Name: ClientDocs
Fields:
DocID primary key autonumber
Document image (the actually file in bytes)
FriendlyName nvarchar 255
ClientID foreign key -[Table Client]
ClientFolderID foreign key -[Table ClientFolders]

Table Name: Folders
Fields:
FolderID primarykey autonumber
FolderName nvarchar 255

Table Name: ClientFolder
Fields:
ClientFolderID primarykey autonumber
FolderID foreign key -[Table Folders]
ParentID int
ClientID foreign key -[Table Clients]

Jul 12 '06 #1
2 1239
you should do it in a conditional statement. You can do it in either
your programming code or in your SQL code. For instance whatever is
passing your parameters (clientid,parentid) to the query should have a
condition applied to it that if the parameter for parentid is null, is
empty, or is equal to 0, then the parameter is set to 0. Otherwise pass
along the parameter as usual. As for the SQL code I would do it like
this.

SELECT * FROM Client WHERE ClientID='parameter for client id here' AND
ParentID='parameter for parent id here'

Or am I missing something here?

ma**********@gmail.com wrote:
Hello Fellow Developers,
I am very new to SQL and ASP.net and in the learning process. I have to
do a small web application that handles documents stored on a sql
database. The requirements of the functionality of the application are
below. I am just having trouble setting my query to work correctly.

Problem:
I want to be able to pull documents and folders that have the same
ClientID. However, here is the catch, the query should take two inputs
- ClientID and ParentID (which is an ID representing FolderID from the
Folder Table; the document/folder does not belong to another folder
then the system will enter ZERO as the ParentID). I hope this is
clear???

Any help is greatly appreciated, as life is a learning experience.

Database Structure:

Table Name: Client
Fields:
ClientID primary key autonumber
Name nvarchar 255

Table Name: ClientDocs
Fields:
DocID primary key autonumber
Document image (the actually file in bytes)
FriendlyName nvarchar 255
ClientID foreign key -[Table Client]
ClientFolderID foreign key -[Table ClientFolders]

Table Name: Folders
Fields:
FolderID primarykey autonumber
FolderName nvarchar 255

Table Name: ClientFolder
Fields:
ClientFolderID primarykey autonumber
FolderID foreign key -[Table Folders]
ParentID int
ClientID foreign key -[Table Clients]
Jul 12 '06 #2
bah i should have looked closer... it's definitely possible but will
take me a bit of time to do. If I have time tomorrow morning I'll try
to help you sort it out.

tfsmag wrote:
you should do it in a conditional statement. You can do it in either
your programming code or in your SQL code. For instance whatever is
passing your parameters (clientid,parentid) to the query should have a
condition applied to it that if the parameter for parentid is null, is
empty, or is equal to 0, then the parameter is set to 0. Otherwise pass
along the parameter as usual. As for the SQL code I would do it like
this.

SELECT * FROM Client WHERE ClientID='parameter for client id here' AND
ParentID='parameter for parent id here'

Or am I missing something here?

ma**********@gmail.com wrote:
Hello Fellow Developers,
I am very new to SQL and ASP.net and in the learning process. I have to
do a small web application that handles documents stored on a sql
database. The requirements of the functionality of the application are
below. I am just having trouble setting my query to work correctly.

Problem:
I want to be able to pull documents and folders that have the same
ClientID. However, here is the catch, the query should take two inputs
- ClientID and ParentID (which is an ID representing FolderID from the
Folder Table; the document/folder does not belong to another folder
then the system will enter ZERO as the ParentID). I hope this is
clear???

Any help is greatly appreciated, as life is a learning experience.

Database Structure:

Table Name: Client
Fields:
ClientID primary key autonumber
Name nvarchar 255

Table Name: ClientDocs
Fields:
DocID primary key autonumber
Document image (the actually file in bytes)
FriendlyName nvarchar 255
ClientID foreign key -[Table Client]
ClientFolderID foreign key -[Table ClientFolders]

Table Name: Folders
Fields:
FolderID primarykey autonumber
FolderName nvarchar 255

Table Name: ClientFolder
Fields:
ClientFolderID primarykey autonumber
FolderID foreign key -[Table Folders]
ParentID int
ClientID foreign key -[Table Clients]
Jul 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
1492
by: mensanator | last post by:
I just installed Python 2.3 (upgrading from 2.1). Version 2.3 is noticably faster and the automatic conversion to long integers is very handy: >>> print 2**64 18446744073709551616 But if...
66
7694
by: roy | last post by:
Hi, I was wondering how strlen is implemented. What if the input string doesn't have a null terminator, namely the '\0'? Thanks a lot Roy
19
1129
by: steve | last post by:
Don't know if this is the correct forum for this, but here goes.. - independent access level modifiers for property get and set members eg. public get, protected set, set provides validation /...
25
2012
by: Nainto | last post by:
I came across this link today. http://tinyurl.com/9c7ta It seems Microsoft is getting involved with Python. What do you think of it? Is it any good? Anything to worry about? -- Zach
17
2702
by: hurry | last post by:
Hi, In my piece of code I see some unprectable behaviour for simple functions like for example pow() function in math.h returns, -1#IND0 for simple arguments like POW( (double) 1, (double) 2 ) ...
5
1819
by: sleepinglord | last post by:
An example: I have a select input. I wanna catch those onclick events which is not a onchange events. How to implement it? And in general, there's some basic kinds of events, and I wanna catch...
111
5425
by: Enteng | last post by:
Hi I'm thinking about learning C as my first programming language. Would you recommend it? Also how do you suggest that I learn it?What books/tutorials should I read for someone like me? Thanks...
1
1201
by: thangasiva | last post by:
Hi,i am newly posting this can you give me the solution to following 1. Text box1 should be displayed the value of field1 (table1.tamil) from table randomly, when I click the command button1....
0
1119
by: Lussy | last post by:
hello, have u clicked on the link,if not i think you are going to miss the great offer,because i get 30$ with in a day,it has a certain limit of 15 days,so do it hurry.............. so...
1
1172
by: anjali | last post by:
Hi friends Hope this mail finds you in cheerful mood. We are an IT Consultancy and we have our Head Office in Bangalore. We are having our branch offices in all over India. We have lots...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7392
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5479
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4920
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3105
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3101
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
307
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.