|
With VB6/ADO you do not use named parameters in the CommandText... you use positional parameters:
cmd.Parameters.Append cmd.CreateParameter("Entry_ID", adInteger, adParamInput, , lEntry_ID)<br />
cmd.CommandText = "SELECT * FROM Entry WHERE ID = ?"
More or less the same was as with the ADO.NET ODBC provider.
Regards,
Rob
--
RMTrack a new bug tracking tool. Available now from http://www.rmtrack.com
|
|
|
|
|
rmacfadyen wrote:
With VB6/ADO you do not use named parameters in the CommandText... you use positional parameters
Thats what I was afraid of. The parameters could appear in any order in the SQL (or might not be there at all). Oh well, i'll just have to do it myself with Replace
Thanks
--
Dave
|
|
|
|
|
Umm... doing it with replace is may be a bad idea unless you're careful about escaping and formatting your parameters correctly (sql injection attacks can't happen if you use parameterized queries).
Are you sure the parameters could appear in any order?
Regards,
Rob
--
RMTrack a new bug tracking tool. Available now from http://www.rmtrack.com
|
|
|
|
|
Hi there..
How do I code the syntax :
myTable.Columns["mycolumnName"].myProperty = "value";
I have
a table class 'myTable' that inherits from System.Data.DataTable.
a column class 'myColumn' inherits from System.Data.Datacolumn.
As it is now I don't have acces to 'myProperty' that is a member of 'myColumn'.
-To get access I first have to convert it to 'myColumn' see below ???
((myColumn) myTable.Columns["mycolumnName"]).myProperty = "value";
thx..
|
|
|
|
|
What you're doing looks correct to me. If myTable.Columns["..."] returns a DataColumn type, then you would have to cast it to a myColumn type to use a myColumn property.
I suppose you could define a property like Columns in your custom table class that returns objects of type myColumn rather than DataColumn . Otherwise, just casting is fine.
|
|
|
|
|
Sure, but myTable.Columns returns a collection of DataColumn..
I want the Columns property to return a collection of myColumn
-I have to somehow override the Columns property in my 'myTable' that inherits the Columns property from the baseclass DataTable..
|
|
|
|
|
I think if it were me I would just define a function or property called MyColumns that could return a myColumn object that has been cast by the function from the corresponding DataColumn .
If you're coding in VB, I suppose you could use the Shadows keyword to created your own shadowed property called Columns , but I don't think this would be the way I'd go (and shadows isn't available in C# anyway).
|
|
|
|
|
Yes, but still my issue is not resolved.. I don't have problem getting a single column of type 'myColumn'..
The problem is 'Columns' property still return a collection of type System.Data.DataColumn
|
|
|
|
|
I have a problem with triggers and transactions I need to create a trigger after insert on a table but I would like to fire that trigger only after committing the transaction not before the and on the transaction, any body can help me with this problem I will be thankful for that
regards
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
Mhmoud,
As far as I know triggers cannot be made to work this way. They fire. Period.
I would take you logic in the trigger and make a stored procedure out of it. Then call the new stored procedure after you commit the original transaction. You will not have access to Inserted and Deleted but this is the only way I know to do what you describe
Hope this helps
Bill
|
|
|
|
|
Hi all,
I could not find in or understand the
tutorials about MSDE,
Does anyone know if RDA's possible with MSDE?
I am planning to use SQL CE synchronizing with SQL database.
Thanks in advance.
|
|
|
|
|
Hello buddies,
How can I determine the time distance between two DATETIME values and compare the result with various time units like seconds, minutes, days, ... ?
I guess it has a standard method that I prefer, but anyway my target SQL is MS SQL Server 2000.
Thank you so much for your note
---
"Art happens when you least expect it."
|
|
|
|
|
You need to use the DATEDIFF function. Full details are in the BOL.
store your internet favourites online - www.my-faves.co.uk
|
|
|
|
|
Thank you, Thank you, Thank you
and once more, Thank you
---
"Art happens when you least expect it."
|
|
|
|
|
Hi gurus.
I've also post this in the C# forums, but responds weren't that helpfull.
Hope someone here can help me on this.
During the execution process of the DTS Package, I sometimes encounter this error:-
<br />
Event Source : SomeStepsNameHere <br />
Error Code : -2147024882 <br />
Source : Microsoft Data Transformation Services (DTS) Package Description : Not enough storage is available to complete this operation.<br />
HelpFile : sqldts80.hlp <br />
HelpContext : 1100 <br />
InterfaceError {10020306-EB1C-11CF-AE6E-00AA004A34D5}.<br />
Now, that interfaceError is actually the DTS.dll COM Component.
This error was thrown by the com exceptions in c#.
Here's what got me puzzle. It's definately not a memory or HD issue because I have 4GB of Ram and 200GB of HD Space. I have verify my transactional log and set it to auto-growth.
Have anyone ever encountered such problems before ?
What my DTS Package do is to connect to Access mDB files and port all the data over to SQL Server 2000. And of cource, if I have 10 MDB files, it will spawn 10 threads within the DTS SQL server. (This is all done programmatically).
Could this be the issue where DTS Com Components are running in Single-Threaded Apartment while CLR is running in Multi-Threaded Apartment ?
Hope you can help me out on this. It has got me thinking night and days...
Here's my sample code trying to force it running in STA, but when i check it in the onStart Method, threads are still running in MTA mode.
<br />
static void Main()<br />
{<br />
Thread t = new Thread(new ThreadStart(WorkerThread));<br />
t.ApartmentState = ApartmentState.STA;<br />
t.Start();<br />
}<br />
<br />
static void WorkerThread()<br />
{<br />
ServiceBase.Run(new System.ServiceProcess.ServiceBase[] { new TestSvc() });<br />
}<br />
Note:- this is a window services that use a FileWatcher Component/Timer Component. It basically detects any activities in the folder and then picks up the mdB files and start processing and saving it as a DTS Package, then executes it.
But I'm not even sure if Threading Apartment State is the issue here.
Hope to hear back from all the dts gurus out there.
Stanley
|
|
|
|
|
Hi Gurus,
I managed to solve this mystery puzzles.
I just want to share with the c# community as to how this problem is fixed.
Now first of all, the problems described aboved has nothing to do with not having enough memory or hd space. The reason why this is happening is due to DTSLookups. Now, my production server is running on w2k Advance Server, and my testing server is on windows 2003 (since we're moving in this path).
On the w2k environment, the dts code works. But, it doesn't work with the w2003 environment. To workaround this issue, I have basically, removed all the DTSLookups and introduce another extra steps (stor procedure) to do what the lookups was doing. Up to this point, no more com exception errors, once the workaround has been implemented.
Note:- The error description thrown here is meaningless.
Stanley
|
|
|
|
|
Hello,
For a project of mine, I need a database. I installed SQL server 7, and created the database in it.
Now I need to acces the database in my application. I quickly decided that it would be best if I used a class to represent the database in my application. My knowledge about programming a database ends here...
My program is written in C++ (and a part of it uses MFC). The application is a NT Service and needs to be connected to the database.
I would like to know wich classes I should use to create my own database interface (class that handles the connection and such with the actual database). I would like a general approach so that it is easy to build support for other databases as well.
Thanks in advande.
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
|
Thanks alot, this is just what I need.
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Hi, i usually create a script file in SQL query analyzer to create database, create table... in SQL server. But now I have design my database in SQL server using wizard (interface). I would like to know, how could I convert my structure of my database in to a script file that could be use in SQL query analyser? if it is possible it is very easy for me to distribute my database via a diskette.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
In the Enterprise Manager navigate to your database. Then right click the database entry in the tree on the left and select All Tasks-->Generate SQL Script...
Follow the wizard to ensure that all the elements you want to script are output.
Do you want to know more?
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Thank you very much, I will try it latter.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
hai i am working a project where i have to get a excel format on my VC++ dialog based application from the database by a click of a button. please help in this
|
|
|
|
|
hi,
Please be little more specific.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
hai nair, let me explain ,that what i want to do . I have a dialog based application which has to get data from the database in an excel format by a click event . which is similar to the datagrid Active X control where we can ADD , DELETE and UPDATE the record .
My project is related to a call center where they have a shift roster , in this the key is the shift time , So I have to get data from the database in a excel format , for a particular shift time the number agents working and there area of stay , the shift roster that is the [ Date working and leaves details]
|
|
|
|