|
I have a table as such:
rowID - rowParentID - rowTitle
rowID = Indentifier
rowParentID = is the parent of the row. Means that it belongs below the row that has rowID = rowParentID.
I need to show all rows in a tree view style in ASP.NET
I am new to SQL so any help will be usefull. I have no idea how to do this in stored proceedure..
|---------------|
| theJazzyBrain |
|---------------|
|
|
|
|
|
I have no idea about C++/MFC but I think that I shoulf be able to understand the logic at least...
Yeah, please send it to jason@skc.gr
Thanx alot
|---------------|
| theJazzyBrain |
|---------------|
|
|
|
|
|
I made an application in Visual C++ that uses ADO to connect to SQL server. My application is multiple threaded, there are five threads and each thread has its own connection object.
Someone told me that this way of making connection is not too good and that i should use connection pooling.
Can anyone tell me what is connection pooling in ADO ? How can i use it ? Is there any resource from where i can learn how to use ADO connection pooling ?
|
|
|
|
|
VC++ 6.0 and Access 2000 don't go hand in hand. IOW, you cannot develop an application using VC++ 6.0 AppWizard if the application will be using Access 2000. (Microsoft saw to that!!!!)
If you have a database application that already exists, there is some hope for getting it to use Access 2000, but if you are just developing it, AppWizard will NOT do it for you (meaning, you will bomb out where it asks for a Data Source.)
Has anyone gotten this experience and found a way of creating a new application and then somehow get it to work using Access 2000?
Thanks.
William
Fortes in fide et opere!
|
|
|
|
|
If you use the standard ODBC driver, then you shouldn't have any problems. I have not used the MFC CDatabase/CRecordset classes in years because they are limiting and crappy. You may consider using your own ODBC class wrappers.
onwards and upwards...
|
|
|
|
|
|
does sql has if else statement like c++, vb..?
I have following statement
SELECT [k1] & ';' & [k2] & ';' & [k3] AS AllK FROM TEST;
That Query Statement combine strings of k1,k2,and k3 as k1;k2;k3 and insert it into AllK.
However when K1 field has nothing in it, then the result is ;k2;k3
again, when k2 field is emtpy then the result is k1;;k3
so how can i detect whether the field is empty or not to get the result as k1;k3 but not k1;;k3???
Thank you
|
|
|
|
|
I do this quite offen COALESCE function
COALESCE( @BarrowDate, GetDate() )
If BarrowDate is null then GetDate() is called.
It returns the first non null value
I am sure there are others ways
Bo Hunter
|
|
|
|
|
Try using CASE .
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
Write Query like this-
Select ISNULL([K1] + ';', '') + ISNULL([K2] + ';', '') + ISNULL([K3] + ';', '') AS AllK FROM TEST
Ofcourse I am using the property of SQL that sum of a NULL string with another string is NULL. So if any of the K1, K2 or K3 field is NULL, [K1] + ';' will give NULL.
HTH.
Gaurav
|
|
|
|
|
hi all i have the table like
[ number ] [ name ] [ k1 ] [ k2 ] [ k3 ] [ h1 ] [ h2 ] [ h3 ] [ allK ] [ allh]
[ 1 ] [ pp ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ]
[ 2 ] [ dd ] [ a ] [ b ] [ c ] [ d ] [ e ] [ f ]
how should i do to get following table?? from each and every single record, take k1,k2,k3 and put into allk as k1;k2;k3
similarly, take h1,h2,h3 and put into allh as h1;h2;h3
<br />
[ number ][ name ] [ k1 ] [ k2 ] [ k3 ] [ h1 ] [ h2 ] [ h3 ] [ allK ] [ allh ] <br />
[1 ] [ pp][2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 2;3;4 ] [ 5;6;7 ] <br />
[ 2 ] [ dd ] [ a ] [ b ] [ c ] [ d ] [ e ] [ f ] [ a;b;c ] [ d;e;f ] <br />
|
|
|
|
|
Well, the way to go would definitively be by creating a computed column. See MSDN for details on how to do this with the CREATE TABLE command. The expression you need is something like this:
k1 + ';' + k2 + ';' + k3
so, the column on the create table would be defined as:
allk as k1 + ';' + k2 + ';' + k3
Doing things this way, you won't need storage space for allk, and it will be calculated as needed.
Another (better, in most cases) way is by using a view.
ORACLE One Real A$#h%le Called Lary Ellison
|
|
|
|
|
Thank you very much for your reply..
I'm totally new to SQL. I'm using Access. I have the form, the user select all the fields as neccessary, and insert to the table by clicking next. I dont' want to create the new table but getting the some coloumn fields data ( information ) and insert it to another column of the same row. I dont' even know if I have to use SQL.
similar to this table
<br />
[num][k1][k2][k3][h1][h2][h3][allK][allH]<br />
[001][aa][bb][cc][dd][ee][ff]<br />
<br />
<br />
updated table<br />
[num][k1][k2][k3][h1][h2][h3][allK][allH]<br />
[001][aa][bb][cc][dd][ee][ff][aa;bb;cc][dd;ee;ff]<br />
<br />
and I have 1000s of record in the same table.
Can you please tell me how to do it, can you also give me some SQL code if i need it.
Thank you Daniel
|
|
|
|
|
SELECT [k1] & ';' & [k2] & ';' & [k3] AS AllK FROM TEST;
this is the query statement that I got the table..
I have another problem.. how can I not entrying anything to the ALLK fields if the fields k1,k2,k3 contain empty text?
anyway of saying is how can i check whether k1,k2,and k3 contain emtpy text?
|
|
|
|
|
I just found out that the OLEDB driver for SQL Server 2000 does not support nested transactions. I've solved this by applying a small "hack" in a "helper" class of mine.
However, I feel that my hack isn't robust enough (I'm relying on an error code returned by CSession/ITransactionLocal::StartTransaction()). Surely, this is a problem many have bumped into. Do you have any favorite workarounds for this?
I have a couple of ideas up my sleeve, but I'm too tired to deal with this now (at the end of the day). So I figured you'd have some ideas which I could consider and compare to what I have in (my currently dizzy) mind tomorrow morning while sipping some tea.
--
Now we live in a world of uncetainty
Fear is the key - to what you want to be
You don't get a say, the majority gets it's way
You're outnumbered by the bastards till the day you die...
|
|
|
|
|
Hi All!!
I have binded my text fields to DataColumns of table at runtime.In data navigation mode, all text fields of my application are disabled. When I press the 'Add New' button, all fields are enabled and cleared.
Problem is that when I focus to next control, all the data of current record is again loaded in all textboxes. While I want to remain them clear.
plzzzzzzzzzzzzzzzzz help me.
Thanx in Advance
sorry for my bad English.
|
|
|
|
|
Is there a way to get the last created identity column from access mdb
and what does the memo type map to in the OleDbType enum for access mdb
and the max length?
Thank You
Bo Hunter
|
|
|
|
|
|
Or the DataReader's GetBytes method (consider using the SequentialAccess command behaviour to optimise memory usage).
|
|
|
|
|
Friends,
In an application developed in Visual C++, i used ADO to connect to database. This application runs round the clock. Application establish five connections to the database server and we call stored procedures from SQL server which are very small.
The problem is that our application runs normally for about 13 or 15 hours, after that application starts getting Timeout Error from ADO (SQL server). This error can occur any time, sometimes it occurs just after 4 hours. On netstat at command prompt, i can see that all five connections to database server are in "Established" state. I am unable to find the reason of this error. I changed the operating system, i run both application and SQL server on same machine and on different machines, run my tests on different networks;...but nothing worked for me. Our tables are not too big.
Please tell me if you also experienced such problem
|
|
|
|
|
Use TCP/IP rather than named pipes.
onwards and upwards...
|
|
|
|
|
|
Shah Shehpori wrote:
Friends,
In an application developed in Visual C++, i used ADO to connect to database. This application runs round the clock. Application establish five connections to the database server and we call stored procedures from SQL server which are very small.
The problem is that our application runs normally for about 13 or 15 hours, after that application starts getting Timeout Error from ADO (SQL server). This error can occur any time, sometimes it occurs just after 4 hours. On netstat at command prompt, i can see that all five connections to database server are in "Established" state. I am unable to find the reason of this error. I changed the operating system, i run both application and SQL server on same machine and on different machines, run my tests on different networks;...but nothing worked for me. Our tables are not too big.
In my experience working with databases, long held connections are not reliable. I've worked with DB2, Oracle, SQL Server, Sybase, and all of them are simply not adequate for long term connections. My suggestion would be creating a connection pool and work with disconnected client-side recordsets, which is, btw, the way server applications normally work.
ORACLE One Real A$#h%le Called Lary Ellison
|
|
|
|
|
I have 3 tables:
table1:
DateMod (smalldatetime)
StId
Eid
table2:
DateMod (smalldatetime)
StId
Wid
table3:
stid
I am selecting the max(Wid) and max(eid) based onstid:
select max(Wid),date
from table2 a,table 3
where a.stid=b.stid
group by a.stid
union
select max(eid),date
from table1 a,table 3
where a.stid=b.stid
group by a.stid
At this point I need to compare the dates between the results
(if sid listed in both results) and select the most resent value
from one of the tables for each stid.
How do I do this?
|
|
|
|
|
If this is against SQL Server or Oracle, you could create a stored proc to do this in two passes or get real complex using subqueries in one pass.
TWO PASS:
create procedure GetLastModDate
AS
declare @tStidDates (stid int NULL,
LastModDate smalldatetime NULL)
set nocount on
insert @tStidDates
(
stid,
LastModDate
)
select
A.stid,
MAX(A.Wid)
from
table2 a,
table 3 b
where
a.stid = b.stid
group by
a.stid
insert @tStidDates
(
stid,
LastModDate
)
select
A.stid,
MAX(A.eid)
from
table1 a,
table 3 b
where
a.stid = b.stid
group by
a.stid
select
stid,
MAX(LastModDate)
from
@tStidDates
group by
stid
order by 1
onwards and upwards...
|
|
|
|