|
Hi There
This has got to be an easy one... I am coming to ADO.NET from an ADO background, so i appologise if it comes across as totally stupid!
All i want to do is insert a new row into a table and pull back the autonumber primary key assigned to it.
What i don't want to have to do is:
1) Fill a Dataset in order to get a DataTable definition.
2) Use stored procedures.
Anybody know the answer off the top of their head? Guess i really need to buy a good ADO.NET book.
Thanks In Advance
Rich
|
|
|
|
|
You might get a faster answer if you post this question on the ADO.NET board instead of the C# board.
|
|
|
|
|
|
hello, this is my first post here
i want to create a mysql database connection on a remote machine with c#.
well i tried to work with the SqlDataAdapter to create a connection to my www site but it always says no connection possible
after looking for some tutorials i didnt found anything usefull and i hope someone here could help me out
to make it a bit more clearly - how do i connect?
thanks in advance and sry for my bad english
|
|
|
|
|
A more specific error message would be helpful...
Have you installed an OleDb connector for MySQL?
---
b { font-weight: normal; }
|
|
|
|
|
oh well i never did that before :->
first i made a new project, just dragged the SqlDataAdapter in my Design and then the Assistent popped up. i chosed "new connection" and entered the infos in the textboxes below.
the error that appeared was the following: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied (happens when i want to test the connection or pick a database on the server)
thats all what i did
|
|
|
|
|
Have you configured the database for remove access? By default it's only accessible from the same server.
---
b { font-weight: normal; }
|
|
|
|
|
yes its configured but the other reply has got the info i was looking for
(SqlAdapter is only for SQL not MySQL)
thanks anyway for your help
|
|
|
|
|
That is right.
I thought that the SqlConnection could handle any OleDb data source, but as I double checked this (as I often do when faced with contradictory information), I see that the SqlConnection only handles SQL Server, and the passage about OleDb data sources in the reference about SqlConnection is a reference to the OleDbConnection.
---
b { font-weight: normal; }
|
|
|
|
|
|
very very nice thats exactly what i was looking for
thanks a lot
|
|
|
|
|
Hi all, Please advise from you all
I have DataGridView with only one column (use for dynamic menu)
When user press ENTER key, i want to the focus not moving down and show the content of the column
Please advise... thanks
Regards
Sandi Antono
|
|
|
|
|
If you want a dynamic menu, then why use a DataGridView? Why aren't you using the MenuStrip and dynamically constructing the list of MenuItems as needed?
|
|
|
|
|
Cause i use outlook panel too handle that;)
|
|
|
|
|
Good afternoon!
How to define the moment of connection/switching-off usb devices, its type and ID?
Thanks.
|
|
|
|
|
I'm trying to emulate the Magnify tool except it's a bit more limited. I only want to monitor a specific region of the desktop and zoom at a set %.
Here's the code I have so far...
private void GetSnapShot()
{
Bitmap bmp = new Bitmap(273, 273);
Graphics g = Graphics.FromImage(bmp);
g.CopyFromScreen(formLocationX, formLocationY, 0, 0, new Size(273, 273));
picDisplay.Image = bmp;
g.Dispose();
bmp = null;
}
I dropped this in a timer's tick event, and it's such a ram slob. It'll use up 4-10mb of ram, then go back down, but it seems so inefficient because it's cycling the ram every 3 seconds or so. The windows magnify tool doesn't use that much ram. I've downloaded a few magnify tools (just to see how they operate) and they don't either.
What can I do to make this better?
The 273 hardcoded values are the size of the picture box. I figured it would be better to hardcode the values rather than get the height/width of the picture box everytime. formLocationX and formLocationY is the area it's monitoring.
I haven't figured out how to zoom in it yet. I set the scale transform and that didn't seem to do anything. I'd much rather get this optimized before worrying about the zoom part though (but if it's a simple task that I am overlooking, feel free to let me know).
-- modified at 13:16 Saturday 17th June, 2006
It just dawned on me that I'm creating a new bitmap everytime. I moved that out of there as well as setting it to null at the end. This stopped the ram from going nuts, I still wouldn't mind any possible ideas on how to make it better though.
|
|
|
|
|
The only big optimisation I'd suggest is to not use a timer if at all possible. For example if you're tracking the mouse then handle a mouse move event (maybe possible in managed code, otherwise the Win32 API will come into play). It all depends on whether the timer is neccessary because you're going to be performing this every 3 seconds or so regardless of whether you actually need to.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
|
|
|
|
|
The ram cycling was occuring every 3 seconds, I'm updating the area every 100 milliseconds.
I'm just looking to zoom into a specific area of the screen (regardless of mouse/keyboard input) and update my picbox with the zoomed in area.
The form won't be open all the time. Overall it's not too bad I guess. After getting rid of the bitmap creation in the function it doesn't use any extra ram. CPU load was 0-2% on a P4 3.0c.
Only problem with using the .NET framework is it doesn't capture everything for some reason. It seems to ignore certain windows for no apparent reason.
|
|
|
|
|
ThisIsMyUserName2 wrote: Only problem with using the .NET framework is it doesn't capture everything for some reason. It seems to ignore certain windows for no apparent reason.
Some programs, like the media player, uses hardware acceleration to display graphics directly to the monitor without drawing it to the screen memory.
---
b { font-weight: normal; }
|
|
|
|
|
You will probably need to hook into DirectX to get your performance up and overhead down. There you are working directly with the adapter.
|
|
|
|
|
Hmm, I thought about that, but that's a bit over my head I think. I'm still grasping .NET/c# in general. Going balls out with DX would be too much.
I wonder if it would be faster if I used the windows APIs instead of the .net classes? Use BltBit, etc. Also perhaps the APIs will let me capture certain windows?
When I load a program that's capable of hitting a screenshot or print screen, it'll pickup DX windows on my desktop, so I'm assuming it's possible to do with straight API.
|
|
|
|
|
I want to give at the user this possibility.
How can handle it?
|
|
|
|
|
|
|
You may want to look into the Memento Design Pattern as this design is exactly for the Do/Undo/Redo ability.
|
|
|
|