|
There's no need to P/Invoke for this, just use ContextMenu.Show()
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Hi
I have used this for the slq statem
SELCT FirtName, LastName, ID,From Coustomer WHERE FirstName LIKE '[A-Z]'
C#
private void button1_Click(object sender, System.EventArgs e)
{
oleDbConnection1.Open();
oleDbDataAdapter2.SelectCommand.Parameters["LastName"].Value = textBox1.Text;
dataSet11.Clear();
oleDbDataAdapter2.Fill(dataSet11)
oleDbConnection1.Close();
}
But when I run it gave a and error
can u help me anyone
Harrison Brock
|
|
|
|
|
SELCT FirtName, LastName, ID,From Coustomer WHERE FirstName LIKE '[A-Z]'
SELECT FirstName, LastName, ID FROM Customer WHERE FirstName LIKE ???
??? = I don't see what you want to do here. This is sure no SQL the like operater only allows to use wildcards % and _.
assume next records in DB:
cat
C#
dog
bat
faster
LIKE 'c%' returns cat and C#
LIKE 'c_' returns C#
LIKE '_a_' returns cat and bat
LIKE '_a%' returns cat, bat and faster
% for a range of caracters
_ for just 1 character
Let know what you want and I'll help you with the statement
Try this class named mySQL_Data with method get dataSet. (example with mysql)
public mySQL_Data(string userName, string database, string password, string host)
{
// constructor logic
this.userName = userName;
this.database = database;
this.password = password;
this.host = host;
conString = "DRIVER={MySQL ODBC 3.51 Driver};" + //place here the driver name like you
"SERVER="+host+";" + //find in Windows ODBC description
"DATABASE="+database+";" +
"UID="+userName+";" +
"PASSWORD="+password+";" +
"OPTION=3";
}
public override DataSet getDataSet(string query, string table)
{
OdbcConnection conn = new OdbcConnection(conString);
DataSet ds = new DataSet("name");
try
{
conn.Open();
OdbcDataAdapter da = new OdbcDataAdapter (query, conn);
da.Fill(ds, table);
conn.Close();
}
catch(OdbcException odbcError)
{
MessageBox.Show(
"Native: " + odbcError.Errors[0].NativeError.ToString() + "\n" +
"SQLState: " + odbcError.Errors[0].SQLState.ToString() + "\n" +
"Message: " + odbcError.Errors[0].Message,"ODBC Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return ds;
}
greetz
|
|
|
|
|
I'm guessing the problem is in your select statement (I don't think LIKE '[A-Z]' can work). Can you post the specific error message?
|
|
|
|
|
I have a textbox that I want to enter a value in. Than search the database for the closes matches.
Harrison Brock
|
|
|
|
|
Ok I think you want something like
The user enters 'Arn' and sql gives Arnold
then your like statemint will be Like 'Arn%' or "... LIKE '" + TextBox1.Text + "%';";
Greetz
|
|
|
|
|
Hi, I'm trying to read some old .DBF files with C#. In C, I used Codebase and its available for several hundred dollars for .NET. The question is I also have Visual Fox Pro V8 for .NET. Will FoxPro read a .DBF database and the associated index files? I believe they are .CDX and .MDX files. If so I can save a few hundred $$.
Thanks,
Glenn
|
|
|
|
|
There is no way that you can use Visual Foxpro code to read data from DBF files, and use the data in a C# application. This is because Visual Foxpro is not CLS compliant.
Visual Foxpro only supports the OLE DB route for other applications to access data stored in DBF files.
If you are implementing a client-server application, then it should be possible to do a web-service that uses Visual Foxpro code for the web-method to read DBF files. The data returned by the web-method(s) may be used by any type of client that understands SOAP.
See Visual Foxpro Overview[^]
If you are only interested in reading the DBF files, then you can find many freely available C# classes.
|
|
|
|
|
Hi all.
I am a new learner of c-sharp and also this is my first mail in this group.I hope I will got my answer from here...
My question is that I have made a method which accepts an Object type and I have displayed the real runtime type and methods of any object passed to the method. the code is as follow:
public void display_record (Object O)
{
Type tmptype = O.GetType();
FieldInfo[] tmpproperties = tmptype.GetFields();
Console.WriteLine("Type = " + tmptype);
Console.WriteLine("lenght" + tmpproperties.Length);
for ( int tmppi = 0 ; tmppi < tmpproperties.Length ; tmppi++)
{
Console.WriteLine(tmpproperties[tmppi]);
}
}
Now i want to display the real values stored in the attributes of that object(like "ABC" stored in name attribute).How can i do that.Any idea??
Plz reply soon as help as I am in hurry n wana good solution ASAP.
Thanx to all helpers.
|
|
|
|
|
Change your last writeline to:
Console.WriteLine("{0} = {1}", tmpproperties[tmppi], tmpproperties[tmppi].GetValue(O));
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Hi,
I was experimenting on the printing functions and found out you can get a lot of information about a printer trough System.Drawing.Printing.PrinterSettings. But I'm missing the minimum margins where the printer can print.
Most printers can't print to the edges of a page. These margins varies for eacht printer. Where can we find this information?
thx.
|
|
|
|
|
mistery22 wrote:
can we find this information?
Check out the Margins[^] class.
-Nick Parker
|
|
|
|
|
thx for the reply...
But the Margins class allow to set margins, but it doesn't get the minimum margins of a printer. What I need is really the margin where a printer can't print.
For example a HP OfficeJet d155 minimum margins are
Left: 0,34 cm
Right: 0,93 cm
Top: 0,00 cm
Bottom: 0,67 cm
How can we get this information in .NET?
thx
|
|
|
|
|
I’m using the MS DataGrid on a form. Each row displays the state of an
instance of a class. When I load this form it creates the collection of
these classes and spawns a maintenance thread that keeps these instances
updated with info scraped from a website. Each class instance has a
reference to the DataTable of the DataGrid and is able to update its own row
in the grid. This works fine. You can sit back and watch this grid
refreshing "in the background" while manipulating other elements of the form.
I ran into problems when I tried to have this thread delete a row from the
grid. Intuitively this makes sense since there is probably a race condition
between the form thread and the maintenance thread where the delete is taking
place. I got around this problem by having the actual grid row deleted on the form thread.
But I'm worried that there might be some hidden race
condition waiting to happen when I do my updates. Any comments would be
greatly appreciated.
Thanks,
Kevin
Here is the error I get when I delete from the Update thread.
=====
An unhandled exception of type 'System.IndexOutOfRangeException'
occurred in system.windows.forms.dll
Additional information: No value at index 2.
=====
Unhandled Exception: System.IndexOutOfRangeException: No value at index 2.
at System.Windows.Forms.CurrencyManager.get_Item(Int32 index)
at System.Windows.Forms.DataGridRow.PaintHeader(Graphics g, Rectangle
visualBounds, Boolean alignToRight, Boolean rowIsDirty)
at System.Windows.Forms.DataGridRelationshipRow.PaintHeaderInside
(Graphics g, Rectangle bounds, Brush backBr, Boolean alignToRight, Boolean
isDirty)
at System.Windows.Forms.DataGridRelationshipRow.PaintHeader(Graphics g,
Rectangle bounds, Boolean alignToRight, Boolean isDirty)
at System.Windows.Forms.DataGrid.PaintRows(Graphics g, Rectangle&
boundingRect)
at System.Windows.Forms.DataGrid.PaintGrid(Graphics g, Rectangle
gridBounds)
at System.Windows.Forms.DataGrid.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e,
Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods
+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason,
Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Track9.frmMain.Main()
|
|
|
|
|
For pixel access in C#, which method is faster , using unsafe mode to access and manipulate pixels or writing wrapper and calling Win32 API GDI functions???
In broader terms, which technique is faster, unsafe mode or calling native Win32 APIs?
Thanks
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
Unsafe mode (LockBits). You're getting direct access to the bit data via pointers, which is pretty much as fast as you can get.
"Have a heart that never hardens, a temper that never tires, a touch that never hurts." -- Charles Dickens
FLUID UI Toolkit
|
|
|
|
|
jdunlap wrote:
FLUID UI Toolkit
How about fixing all those broken links on the page (and that horrible menu grafix)?
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
leppie wrote:
How about fixing all those broken links on the page
Fixed! Those 3 pages don't even exist anymore, so I removed the links.
leppie wrote:
(and that horrible menu grafix)?
Which one? The one above the sidebar?
"To know what is right and not do it is the worst cowardice." -- Confucius
FLUID UI Toolkit
|
|
|
|
|
jdunlap wrote:
Which one? The one above the sidebar?
2 words: Anti-Aliasing
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
leppie wrote:
2 words: Anti-Aliasing
Yes, I know... that needs to be done. My problem is that the background of the image was white before I added transparency, so the antialiasing that was done was lighter than everything else, instead of darker. I'll fix that.
""It is impossible to rightly govern the world without God and the Bible." -- George Washington
FLUID UI Toolkit
|
|
|
|
|
Haha, it's pretty bad when the UI on the website for a UI toolkit is crappy. Makes you wonder... (Just kidding...I'm sure FLUID will be great )
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
That really is a concern though. I've waited far too long to do some changes that I had noticed earlier, because I was focusing on the project itself and the functional aspects of the site (which aren't complete yet). Since two of my main team members are away at present, I think I'm going to be working on improving the site this week.
"Blessed are the peacemakers, for they shall be called sons of God." -- Jesus
FLUID UI Toolkit
|
|
|
|
|
Take a look at it now. I still need to fix the edges of the big logo, and I'm also going to make the chevron look nicer. The one I have is a bit strange.
"Don't judge each day by the harvest you reap, but by the seeds you plant." -- Robert Louis Stevenson
FLUID UI Toolkit
|
|
|
|
|
jdunlap,
do u hold the fluid UI project?
regards,
jim
|
|
|
|
|
zecodela wrote:
do u hold the fluid UI project?
Yes, I am the project lead.
|
|
|
|