|
Hi Rickard.
Rickard Andersson wrote:
I beleive it's not possible!?
No.Use Memo type.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Mazdak wrote:
Use Memo type
Okay, but how do I do that?
I opened my table in Access 200 in Design mode and checked if Memo type could be used for my field, but no....
Can you explain more?
Thank you very much!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Rickard Andersson wrote:
I opened my table in Access 200 in Design mode and checked if Memo type could be used for my field, but no....
The Memo field is listed under the data type section of your database.
Nick Parker
The greatest lesson in life is to know that even fools are right sometimes. - Winston Churchill
|
|
|
|
|
Nick Parker wrote:
The Memo field is listed under the data type section of your database.
Found it!
In the Swedish edition Memo = PM (which is the same anyway )
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
I have a treeview that is populated from a self joined table in a way analogus to that detailed by Gevik in his article:
http://www.codeproject.com/useritems/2dtreeview.asp#xx281692xx[^]
Now I've been trying to work out the most efficent way to delete a from the treeview and have the corresponding node in the database, plus any children, be deleted. I tried this:
private void CascadeDelete(int iParent)
{
DataView dvView = new DataView(dsData.Tables[0]);
dvView.RowFilter = "ParentID = '" + iParent + "'";
while (dvView.Count>0)
{
DataRowView thisRow = dvView[0];
int thisID = Int32.Parse(thisRow["TypeID"].ToString());
CascadeDelete(thisID);
MessageBox.Show("DELETING: " + thisRow["strType"].ToString());
thisRow.Delete();
}
}
The problem, I think, is that as the recursion unwinds the DataRowView of the caller is out of date because the callee has changed it, but trying to update it again (by uncommenting the above lines) doesn't seem to work. The end result is that when I try to call dsData.GetChanges() it returns null.
Here's a example of the messed up recursion, give the nodes:
1
|-3
|-2
|-6
|-5
| |-7
4
I get this series of "deletion": 3,6,7,7,5,4,6,5,4,2,3,2
Any ideas on an efficient (or even just working!) way to do this? I could just issue a bunch of individual SQL statements to delete each row, but that seems horribly inefficient.
Thanks
|
|
|
|
|
|
Sorry, can you explain what you mean?
|
|
|
|
|
I would have to insert around 500 records every 10 seconds into a table in Access 2000. I am using ADO. What is the most efficient way to do this with good performance.
Is it possible to pass all of the 500 records to a query using some kind of SafeArray parameters and Insert them all at once?
Any tips how this can be accomplished ?
Thanks
|
|
|
|
|
I think stored procedure is the best way.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Could you please help me in with a small sample code.
Do I have to send the records as an array and loop the INSERT statement for all records? I am not quite sure if all this is possible in ACCESS.
I guess my question would be can I pass an array to Stored proceedure, if Yes how?
Thanks for your time.
|
|
|
|
|
I am trying to reset the PK on a SQL Server table. The key is auto populated and automatically increments by 1. I have cleared all the data and want to repopulate. Is there a way to have the first Id be equal to 1? Currently numbering starts where the last data ended.
Second question is there a way to print the row number in a select statement?
Jason W.
|
|
|
|
|
If I remember correctly, to reset the row number field you need to TRUNCATE TABLE.
Michael
"I've died for a living in the movies and tv.
But the hardest thing I'll ever do is watch my leading ladies,
Kiss some other guy while I'm bandaging my knee."
-- The Unknown Stuntman
|
|
|
|
|
Exactly what I was looking for thanks.
Jason W.
|
|
|
|
|
you can also do this by changing your identity to "NO" in the design view, saving the table and then re-instating the identity to YES
|
|
|
|
|
The only mode that I know, is removing the PK state, repopulating the fileld and setting like PK again...
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
To reseed your identity column you can use the following dbcc command. Not too sure if it's supported though:
dbcc checkident ( <tablename>, RESEED, <newvalue> )<br />
example:
<br />
dbcc checkident(authors, RESEED, 100000)<br />
|
|
|
|
|
Oh, and for ther row number you might want to check out this link:
http://www.sqlteam.com/item.asp?ItemID=1491
|
|
|
|
|
I want to know if there is a way to get the PK from a row the minute I insert information. Here's the scenario, what's the most efficient way of doing this?
1. I have 50 tables that represent 50 HTML forms.
2. I am inserting results from OnlineAccess.asp into dbo.OnlineAccess.
3. I am keeping all dateTime stamps along with the status of the request (OPEN, BEING PROCESSED, COMPLETE) in another table called dateTime.
4. I want to get the PK of the information entered into dbo.OnlineAccess so that I can insert this into dbo.DateTime for relation to dbo.OnlineAccess's information.
Is there any "bi-di" capabilities that can be used to return the PK without having to run another line of code to SELECT the PK WHERE <and then="" pass="" results="" of="" the="" form="" back="" again="">. For instance, I know I can do it this way, but it seems like too much leg work:
sqlInsert = "INSERT into OnlineAccess(userID,lastName,firstName,...) values('"&userID&"','"&lastName&"','"&firstName&"',...)"
sqlSelect = "SELECT requestID FROM OnlineAccess WHERE userID='"&userID&"' AND lastName='"&lastName&"' AND ..."
RS = MyConn.Execute(sqlSelect)
requestID = RS("requestID")
sqlInsert = "INSERT into DateTime (requestID,status) values('"&requestID&"','OPEN')"
(I have a trigger that takes care of the dateTime stamps based on the status)
Can anyone help me on this one? Thanks in advance!
Robby
|
|
|
|
|
Probably the best way would be to write a stored procedure that can then insert your data and then return the PK to the caller.
I know this works with SQL Server, but I've had trouble returning values from SPs in Oracle.
Dave.
|
|
|
|
|
Indeed, using a stored procedure would by far and away be the best solution.
after an insert, sql server special variable @@IDENTITY contains the new pk of what you just inserted. so this will probably work:-
sqlInsert = "INSERT into OnlineAccess(userID,lastName,firstName,...) values('"&userID&"','"&lastName&"','"&firstName&"',...) ; SELECT @@IDENTITY AS [newkeyname]"
RS = MyConn.Execute(sqlInsert)
requestID = RS("newkeyname")
But really thats a bag of sh!t of an implementation. Stored procedures are the way to go. Why?
1. stored procedures run much quicker, because they are precompiled.
2. They are like functions in proper languages; you can change the internal code without changing the interface.
You could most probably do the whole job in one SP, like this:
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE [p_YourProc]
@UserId int,
@Firstname varchar(100),
@Lastname varchar(100),
@NewPKout integer output
AS
-- define a sql variable
declare @NewPK int;
-- do the main insert first.
INSERT into OnlineAccess(userID,lastName,firstName) values
( @UserId, @LastName, @Firstname);
-- retrieve the new key
select @NewPK=@@IDENTITY;
-- do the other inserts
INSERT into DateTime (requestID,status)
values(@NewPK,'OPEN')
-- might as well send the pk back to asp
set @NewPKout = @NewPK
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
There. Bob's your uncle.
Signature space for rent. Apply by email to....
|
|
|
|
|
Using Access 2000 and ADO VC++6.0
I am executing the following statement..
VARIANT Params[2];
Params[0].vt = VT_I2; Params[0].iVal = 1;
Params[1].vt = VT_R4; Params[1].fltVal = 8.99;
m_pCommand->adCmdText = "Query4";
m_pCommand->ActiveConnection = m_pConnection;
m_pCommand->Execute(0, Params, adCmdStoredProc);
Generates an exception {DB_E_PARAMNOTOPTIONAL}
Query4 in Access is as follows:
PARAMETERS vID Short, Rad IEEESingle;
INSERT INTO TABLE1 ( ODID, MeasRadius )
VALUES (vID, Rad);
Thanks for your help in advance.
|
|
|
|
|
You need to inform the type of Param, if input or output, for example...
But I see that you are passing a float param,, in that case you MUST to inform the presicion and the scale
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
How to inform in/out or precision and scale in argument list of Execute method.
Thanks
|
|
|
|
|
I saw that you are using a variant to inform the parameters, but if you use use a Parameter type you must to do the following...
pParameter->Direction = (ParameterDirectionEnum)nDirection;
pParameter->PutPrecision(nPrecision);
pParameter->PutNumericScale(nScale);
Remember: When you are using a parameter type float, double, decimal, you must to inform the presisicion and the scale...
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I'm learning writing SQL query now. If I, for example, want to retrieve information from 3 joining tables (T1, T2, T3), and only want to return the latest failed task and task name is 'Mailboxes', I wrote the following query:
select top 1 TT.task_type_desc, TL.starting_time, AAC.type_code_value
from tasklog as TL inner join task_type as TT
on TL.task_type_id=TT.task_type_id
inner join aatype_code as AAC
on AAC.type_code_id=TL.task_status and AAC.type_code_class='task_status'
where AAC.type_code_value='Failed' and TT.task_type_desc='Mailboxes'
order by TL.starting_time desc
It gave me the required result. But how to do this query without using "top 1" and still get the same result? Thanks!
|
|
|
|