|
From what I can piece together from your submissions, your calling the Update method on the dataadapter, but using an INSERT SQL statement on that command. If your using an INSERT statement, are you also running a SELECT command after the INSERT so that dataset gets updated and you receive the new record with it's jobID? The jobID won't get created until the new data is commited to the SQL database.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I thought I already have SELECT Command after INSERT on the stored procedure.
Do I need to add another one?
This is my stored procedure for the insert command:
<br />
ALTER PROCEDURE programservice.insert_job<br />
(<br />
@JobID int output,<br />
@CustomerID char(20),<br />
@Date datetime<br />
)<br />
AS<br />
SET NOCOUNT OFF;<br />
INSERT INTO dbo.table_job(CustomerID, Date) VALUES (@CustomerID, @Date);<br />
SELECT JobID, CustomerID, Date FROM dbo.tabel_job WHERE (JobID = @JobID)<br />
SET @JobID = SCOPE_IDENTITY()<br />
I still don't understand why can't I set null to the JobID dataset, since I already set the niilable properties to TRUE.
Is it possible to update or insert the data without the usage of Dataset? Since this is stored procedure, and I believe that the process took place on the database / Server.
Also, is there another way of creating autonumber ID like in this case?
The Database are very likely to be processed by more than one client at the same time.
|
|
|
|
|
Like the first responder said in your post, you SQL statement IS wrong. You said you corrected it, but you changed it back to the incorrect statement again:
ALTER PROCEDURE programservice.insert_job(
@JobID int output,
@CustomerID char(20),
@Date datetime
) AS
SET NOCOUNT ON
INSERT INTO dbo.table_job(CustomerID, Date) VALUES (@CustomerID, @Date);
SET @JobID = SCOPE_IDENTITY()
SELECT JobID, CustomerID, Date FROM dbo.tabel_job WHERE (JobID = @JobID)
The JobID will not have a number until SQL commits the new record to the database (the INSERT statement). Then you can get the new JobID into @JobID using SCOPE_IDENTITY(). Then the SELECT statement returns the updated record to the caller as the sole record in the dataset.
Since JobID is the Primary Key and IDENTITY, it CAN'T ever be NULL...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I figured out the problem already. It was the dataset.
I tried to delete and start from beginning again, create the dataadapter, but this time, I did not generate dataset.
So, First I delete the table from SQL Server, and then create new one with the same name.
I change the property of the table in design mode, Identity = Yes, Identity Seed = 1, and Identity Increment= 1.
And then create Dataadapter in design mode, without generating dataset.
I ran the compiler, and it worked fine.
I guess what I did previously was correct but probably messed up in the middle.
Nevertheless, thank you very much Dave. You explained to me how the autonumber works.
|
|
|
|
|
In a M*N Rectangle, i want to Highlight K points .
The K points must be well-distributed.
How to do it ?
|
|
|
|
|
Well, you'll just have to use a well-distributed random number generator to generate coordinate pairs for the points. System.Random should be fine.
|
|
|
|
|
Hi,
I received from a customer an SNMP MIB file for remote a device with TCP/IP.
I looking some help,link or sample for use it.
Best Regards
youssef
|
|
|
|
|
Why did the customer send you this file? What do you want to do with the information it provides?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I received this file for controlling a device and received some alarms.
I received in the same time a serial protocol but it is so slowly for received the all alarms and set some parameters.
I have 50 devices to control !!!! in the same time.
Best regards
youssef
|
|
|
|
|
The MIB file usually get imported into some management application like HP OpenView. It describes to that application what the device is, it's properties, controls, alarms, ...
Are you writing your own management application?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
yes, if you want.
I have been developed an automation that controls many device for telecoms with some GUI.
Since always, I used the protocol series for the communication but recently, Ethernet connection is available and allows more control that a serialport(depends on speed d'exécution, the lenght of the datas) and allows also a profit in serialport connections with the servers connected to the system.
Best Regards
youssef
|
|
|
|
|
I'm looking to try and dock two Forms together side by side, basically each form can have its own dimensions. But they should move together when dragged. Can I get a shove in the right direction from anyone ?
|
|
|
|
|
Extend Form and override OnLocationChanged . Also add a property to the class of type Form that you set the Form to be docked.
In your implementation, get the Location of each Form (don't forget to check for null before accessing the other Form ). Some simple math will tell you which side the other Form is in relation to this . If the Left + Width of the other form is, for example, within a certain threshhold of your current Form , then adjust the Location * of the other Form in relation to your current Form.Location .
* Don't forget that since Location (a Point ) is a value type, you must create a new Point and set the Location . Setting Form.Location.X and/or Form.Location.Y will not move the other Form .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Great info Heath, thanks once again...
One last follow-up....how should I go about handling the z-order of the two forms, will one always be active and the other not ? Is it possible to have both windows active at the same time ? Didn't know if you had any tricks up your sleave for making both Forms active at the same time...If not then I think I have all the info I need...
Thanks Again
|
|
|
|
|
Only 1 form can be active at any one time. You could set the z-zorder of one of the forms to be on top and the other form to be directly 'behind' it in the z-order. When you switch the active forms, you can switch the zorder so the form you just left is directly behind the form you just activated.
This may seem stupid to implement because the form that loses focus just drops to the #2 place behind the form/app that gets the focus, but it makes more sense when you click on a different app to bring it to the top of the z-order, then click one of your forms. I think your find that the z-order will become your active form at the top, then the application you just left, the your second form in the #3 spot.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I figured as much, thanks for your reply too.
|
|
|
|
|
Also, if one of these forms acts as the "main" form, you could use Form.AddOwnedForm and pass your "child" forms. This way, each form can be active (only 1 at a time) but they will have a z-order in relation to other processes. So all your applications forms will be over or under other processes. Owned forms will also overlap the "main" form and will be closed when your "main" form is closed.
See the .NET Framework SDK documentation for Form.AddOwnedForm for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Well I've implemented the changes you have suggested and the docking form works fine. However when the form is enlarged and then the large window is moved the movement becomes very jerky. I'm wondering if the movement of both forms is too much for the single thread. So now I'm attempting to multi-thread the app. I'd like to create the main form in one thread and the docked form in a second. However I'm running into a logistical problem where the second thread that creates the Docking form goes out of scope and terminates.
The following code is where I create the second thread.
private void FavWinThread()
{
this.ShowFavWin=true;
frmFav = new frmFavorites(this);
while(!frmFav.WinReady)
Thread.Sleep(10);
frmFav.Show();
}
if(frmFav==null)
{
FavThread = new Thread(new ThreadStart(FavWinThread));
FavThread.Start();
}
I assume I'm creating the thread in the wrong place or I'm not maintaining the thread correctly ? Perhaps someone could give me a suggestion ? Any insight would be appreciated.
|
|
|
|
|
First, you need to make sure that the variable does not go out of scope and that you have a message pump attached to the Form , otherwise it will be closed when the thread terminates (FYI, Application.Run does this with your main form). The easiest way is to call Form.ShowDialog , but don't forget to dispose the form (i.e., call Dispose ) when ShowDialog returns and (if you need to) you get all information from it before disposing it. There are other ways, and reading through the System.Windows.Forms namespace in the .NET Framework SDK at some of the more obscure classes should help if you have experience with native Win32 programming with Windows APIs.
One thing to keep in mind is that you will need to use Control.Invoke to communicate between to controls (i.e., Form s) created on different threads. Also, controls created on different threads cannot be hosted in the same container (which doesn't apply here, but I thought I'd mention it anyway).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ShowDialog() did the trick, but the jerky movement is still there. Again, the movement only slows down when the docking form's size in increased. Any thoughts as to a solution ? I know my question is quite vague, but I'm hoping you might have run into this problem before. Thanks again for all your help.
|
|
|
|
|
There's probably better ways to implement this, but I just threw out one idea. You could explore others using Windows messaging, thereby foregoing the .NET event system which would probably boost performance. I'm sure there's also a few examples out there. You could try to google for them or search http://www.sourceforge.net[^] or something.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi:
Does anyone have a sample onscreen keyboard app in c#?..
Thanks
|
|
|
|
|
Hi,
I incorporated a PLK for my VSPackage. I followed the exact instructions for the PLK implementation as mentioned in the VSIP help (including registering it in the registry). I also verified the PLK info.
When I attempt to run the package (by running project in debug mode – F5, using /noVSIP switch), it gives me an error message “Package XX has failed to load properly…”. Half the time the spawned app just goes blank and hangs and does not even give the pakage load failure message.
However, it does not give any clue as to why the package load failed or what the problem is. Is there any way (any log or anything else) in which I can find out why the package is not loading properly? It does not even produce any trace messages to indicate till what point the load went through.
When I run the app in debug mode (using F5) but without the /noVSIP switch, it runs fine and I can trace through it.
Any help will be greatly appreciated.
Thanks.
|
|
|
|
|
Anyone know how to initiate a file copy and display the progress of said copy?
I can't figure out how to use the CopyFileEx API and it's callback. That's the only way I've seen to do this.
--Tony Archer
"I can build it good, fast and cheap. Pick any two."
|
|
|
|
|
you can open the file manually get the size and copy it in set sized buffers to another file you created, using a progress bar to show the progress.
|
|
|
|