|
TyronX wrote:
And yes I have a OnResize Event but commented out it's content.
There is no OnResize event. If you override OnResize you must either comment the entire definition of the method (including the method itself) or call base.OnResize , passing the parameters you were given. When you override a method you are being called in place of the base class's implementation. Often times the base class implements something in that handler, besides firing the event.
So, if you are overriding it call base.OnResize or comment out the whole thing. If you're handling the Resize event than this isn't a problem (only with cancelable events like those defined as CancelEventHandler can you cancel whatever implementation the base event handler allows, like setting a property or losing focus for things like input validation).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Oh. No, I meant the Resize Event. I wasn't sure wether both were the same
|
|
|
|
|
Hi Everybody,
If got a problem:
When I run my program I get an error:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
I tried a lot of other things but I still get this error.
Can anybody see what the problem is?
The code (of the class):
using System;
using System.Data;
using System.Data.OleDb;
namespace AISDBL
{
///
/// Summary description for Database.
///
public class Database
{
OleDbDataAdapter dataAdapter;
//SqlDataAdapter dataAdapter;
string connectionString;
public Database(string applicationPath)
{
connectionString = @"PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=./data/db.mdb;";
}
public DataSet getNieuws()
{
string SqlString = "select * from user";
DataSet dstResult= new DataSet();
dataAdapter = new OleDbDataAdapter(SqlString, connectionString);
dataAdapter.Fill(dstResult);
return dstResult;
}
}
}
Thanks
|
|
|
|
|
Robske wrote:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
And what does the additional information of the exception say? The answer will be there, without it we cannot help you.
PS: You need to open the Connection, before calling Fill().
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
I Changed a few things but still the same error:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Data.OleDb.OleDbException: The component FROM contains a syntax error.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at AISDBL.Database.getNieuws() in d:\ontwikkelmap\visual studio projects\ais\aisdbl\database.cs:line 33
at AIS.FrmLogin.btnLogin_Click(Object sender, EventArgs e) in d:\ontwikkelmap\visual studio projects\ais\ais\load\frmlogin.cs:line 141
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
AIS
Assembly Version: 1.0.1818.29878
Win32 Version: 1.0.1818.29878
CodeBase: file:///D:/Ontwikkelmap/Visual%20studio%20projects/AIS/AIS/bin/Debug/AIS.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
AISDBL
Assembly Version: 1.0.1818.29877
Win32 Version: 1.0.1818.29877
CodeBase: file:///D:/Ontwikkelmap/Visual%20studio%20projects/AIS/AIS/bin/Debug/AISDBL.DLL
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
I dont understand because it's simple code
|
|
|
|
|
Robske wrote:
************** Exception Text **************
System.Data.OleDb.OleDbException: The component FROM contains a syntax error.
So there is your problem. Could be wrong table name or the one u chose mite be a system table and it doesnt resolve, etc etc.
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
Jepz, ur right, it's the table name that causes the problem.
|
|
|
|
|
If you must use a table name (or field name) that is also a keyword for Access, try putting it in square brakets.
e.g: "Select * from [user]"
Why would anyone waste time arguing with an accountant about anything? Their sole function is to record what happenned, and any higher aspirations are mere delusions of grandeur. On the ladder of productive contributions they are the little rubber pads at the bottom that keep the thing from sliding out from under you. - Roger Wright
|
|
|
|
|
Ur right, that was the problem. user is a keyword!!
THANKS
|
|
|
|
|
Actually you don't. DataAdapter.Fill and DataAdapter.Update - or rather the default implementation of DbDataAdapter that extends DataAdapter and from which the other DataAdapter -derivatives directly derive) will open and close the connection if the connection was not open already.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
I think that the message within the exception would help a little bit more.
So what you have to do is to put your method getNieuws in a try-catch:
<br />
public DataSet getNieuws()<br />
{<br />
try {<br />
string SqlString = "select * from user";<br />
DataSet dstResult= new DataSet();<br />
<br />
dataAdapter = new OleDbDataAdapter(SqlString, connectionString); <br />
dataAdapter.Fill(dstResult);<br />
<br />
return dstResult; <br />
} catch (OleDbException ex) {<br />
Console.WriteLine(ex.Message)<br />
return null;<br />
}<br />
}<br />
Then look at your console what the exception writes back...
I think that would help a bit more
Sebastian Martens
|
|
|
|
|
I Changed a few things but still the same error:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Data.OleDb.OleDbException: The component FROM contains a syntax error.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at AISDBL.Database.getNieuws() in d:\ontwikkelmap\visual studio projects\ais\aisdbl\database.cs:line 33
at AIS.FrmLogin.btnLogin_Click(Object sender, EventArgs e) in d:\ontwikkelmap\visual studio projects\ais\ais\load\frmlogin.cs:line 141
at System.Windows.Forms.Control.onclick(EventArgs e)
at System.Windows.Forms.Button.onclick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
AIS
Assembly Version: 1.0.1818.29878
Win32 Version: 1.0.1818.29878
CodeBase: file:///D:/Ontwikkelmap/Visual%20studio%20projects/AIS/AIS/bin/Debug/AIS.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
AISDBL
Assembly Version: 1.0.1818.29877
Win32 Version: 1.0.1818.29877
CodeBase: file:///D:/Ontwikkelmap/Visual%20studio%20projects/AIS/AIS/bin/Debug/AISDBL.DLL
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
I dont understand because it's simple code
|
|
|
|
|
'user' is a keyword. To use it (or any other access keyword) as a table or field name in a query you must surround it with square brackets.
try "select * from [user]"
Why would anyone waste time arguing with an accountant about anything? Their sole function is to record what happenned, and any higher aspirations are mere delusions of grandeur. On the ladder of productive contributions they are the little rubber pads at the bottom that keep the thing from sliding out from under you. - Roger Wright
|
|
|
|
|
Hi all,
What is the mechanism for implementation of the "undo" and "redo"
functions in those applications, e.g. in a text editor ?
Are there any sample codes or reference in C# ?
Thanks
|
|
|
|
|
How you implement undo/redo is entirely dependant on the type of data you're working on.
For example, for a bitmap editor, an incredibly simple way (but somewhat naive) is to have two dynamic stacks - an undo stack and a redo stack.
Every time you change the bitmap, just place a copy of the image before the change onto the undo stack.
When the user selects to undo, push the current bitmap into the redo stack, and pop the top image off the undo stack.
Now if you're smart, you can store just the change in the stack rather than the whole image, which will use less resources
One thing to note is that undo/redo is far easier to implement if it's done from the start - trying to shoehorn undo/redo functionality into an existing application can be incredibly tricky
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
I'm calling an external COM object.
I want to be able to identify when it returns S_OK and when it returns S_FALSE.
Any other HREUSLT returned by the COM object is properly translated by the CLR to a COMException object. Nevertheless S_FALSE is treated as a success thus an exception isn't thrown.
How can I get this return code ?
I look at the registers and I can see EAX change according to S_OK/S_FALSE, but I can't access that data in any way.
Thanks
|
|
|
|
|
Hi,
Can anybody told me that how to share a single class between 2 or more then 2 developers on Visual source safe.
thanks
montu3377
|
|
|
|
|
The current version of VSS doesn't support multiple people having same file checked out. You'll have to take turns, wait for new version, or use a different source control application.
By the way this has nothing to do with C#
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
you mean to say that in C#2005 (express or whidbey) also we don't get facility of share class on vss as we are using vs2005.
|
|
|
|
|
Hi all~
E.g "Select * from table_A where firstName Like '%" + string + "%'";
How to change the ad-hoc sql to prepared statement using operator 'like' and '%'?
Thanks
|
|
|
|
|
Your question belongs in the SQL / ADO / ADO.NET forum. This forum is for questions related to C# only.
Forums more specific to ADO.NET and ASP.NET exist for questions about such topics despite what language you use, since all managed languages compile down to pure or mixed Intermediate Language (IL) and have access to the Base Class Library (BCL; at least what is CLS-compliant as dictated by the Common Language Infrastructure (CLI)).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
I need to display avi file using DirectX and C#. Later stage I need to save frames from this avi file to a bmp file. I would appreciate if someone can provide examples/tutorials and more info.
Thanks
|
|
|
|
|
Rather than taking a dependency on the rather large Managed DirectX 9 assemblies (and required DirectX 9 runtime) or - worse - marshaling so much data across managed and native boundaries by P/Invoking the native APIs, consider ripping frames from an AVI if you have control over what codec they use (i.e., they're not using the DivX codec for video, for example).
Take a look at some of the articles from a search for AVI[^] on this site (always a good idea to search, first). Many of these articles - especially from Corinna - detail how to display and rip AVI frames.
If you need to display about any video format (taking into account any possible audio codec the A/V file may use), then you'll need to take a dependency on DirectX[^] (about 34 MB from http://www.microsoft.com/downloads/details.aspx?FamilyId=2C40A7A5-7742-44D2-9F5C-420815448EA4&displaylang=en[^], which includes both the runtime and managed assemblies).
Playing video and audio in Managed DirectX couldn't be easier:
using System;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.DirectX.AudioVideoPlayback;
class VidExample : Form
{
static void Main(string[] args)
{
if (args.Length > 0)
Application.Run(new VidExample(args[0]));
else
Console.Error.WriteLine("Please provide a video filename.");
}
VidExample(string filename)
{
Video vid = new Video(filename);
vid.Owner = this;
vid.Play();
}
} Use the Video class and set the Video.Owner property to a Control that acts as the surface. Open a file or URL and call Play .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi, does anyone know how can put in the datagrid textbox with the values that comes from a Database?
Thx
|
|
|
|
|
marck.santos wrote:
datagrid textbox
What's a "datagrid textbox"? You mean the DataGrid class? Read the documentation[^] for the DataSet class, which contains examples in both C# and VB.NET about how to fill a DataSet using a DataAdapter derivative like the SqlDataAdapter (for Microsoft SQL Server 2000) then how to bind the DataSet to a DataGrid .
Read the documentation[^] for the DataGrid for information and examples more specific to the DataGrid , since a DataSet can be bound to many different data-bound controls.
There's a lot of information and examples that need not be repeated here. You can find information about pre-defined table styles (column types, formats, and sizes) in the DataGrid.TableStyles property documentation. You can read information about updating a database from changes in a DataSet by reading the documentation for the DataAdapter.Update method (which derivates like SqlDataAdapter and OleDbDataAdapter inherit).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|