|
surasaku wrote: Hi Guffa,
Thanks for reply my message. I use Access database.Could you please see my code below? After debugging,the error message is "Syntax error in INSERT INTO Statement". Where is it wrong?
[Code]
string sql2;
string ContentUpdate = textBox2.Text;
DataView dv4 = new DataView(Dset.Tables["myData"]);
dv4.RowFilter = "Date =#"+dateselect+"#";
if (dv4.Count!=0)
sql2 = "UPDATE Content SET Content = '"+ContentUpdate+"' " +
"WHERE Date = #"+dateselect+"#";
else
sql2 = "INSERT INTO Content(Date) VALUES(#2006-05-30#)";
OleDbCommand cmd = new OleDbCommand();
OleDbTransaction trans;
try
{
conn.Open();
trans = conn.BeginTransaction();
cmd.Connection = conn;
cmd.CommandText = sql2;
cmd.Transaction = trans;
cmd.ExecuteNonQuery();
if(MessageBox.Show("Are you sure to Save data?","Data
Saving",MessageBoxButtons.OKCancel) == DialogResult.OK)
trans.Commit();
else
trans.Rollback();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
finally
{
conn.Close();
}
Date is a reserved keyword. Change the field name, or if that is not possible, use brackets [] around the field name in the query.
---
b { font-weight: normal; }
|
|
|
|
|
Hello!
I have this code:
GraphicsPath path1 = new GraphicsPath();
path1.AddEllipse(10,10,100,100);
PathGradientBrush brush1 = new PathGradientBrush(path1);
brush1.CenterColor = Color.White;
Color[] colorArray2 = new Color[] { ScaleColor(Color.White, 0.25f) };
Color[] colorArray1 = colorArray2;
brush1.SurroundColors = colorArray1;
-----------------------------------------------------------------------------------
public static Color ScaleColor(Color sourceColor, float scale)
{
int num1 = (int)(sourceColor.R * scale);
int num2 = (int)(sourceColor.G * scale);
int num3 = (int)(sourceColor.B * scale);
if (num1 > 0xff)
{
num1 = 0xff;
}
if (num2 > 0xff)
{
num2 = 0xff;
}
if (num3 > 0xff)
{
num3 = 0xff;
}
return Color.FromArgb(num1, num2, num3);
}
---------------------------------------------------------------------------------------
this works fine but when i change the size of the ellipse and the width or height is zero my project shows an exception : Out of memory
Somebody knows why this happen or why can i do to fix this?
Regards,
Alberto Martinez
|
|
|
|
|
hi everyone!
i'm making an application and i want to use in it an error reporting system.
i want to make the program sent an email (with enclosure) without open the email browser.
just send it...
i want to specify the enclosure (e.g. the path of a picture).
can someone help me?
Thanks in advance
Enrico
VentoEngine corp.
Program your life ^^
|
|
|
|
|
For framework 1.1: System.Web.Mail namespace.
For framework 2.0: System.Net.Mail namespace.
---
b { font-weight: normal; }
|
|
|
|
|
can you give me more information?
VentoEngine corp.
Program your life ^^
|
|
|
|
|
Ventomito,
Here's a routine I keep around for such things. You'll naturally need to insert the name of your smtp server in the slot indicated. Hope this helps.
using System.Web.Mail;<br />
<br />
protected Boolean SendEmail(string strFromEmail, string strToEmail, string strSubject, string strBody)<br />
{<br />
Boolean bStat = false;<br />
try<br />
{<br />
MailMessage Message = new MailMessage();<br />
Message.To = strToEmail;<br />
Message.From = strFromEmail;<br />
Message.Subject = strSubject;<br />
Message.Body = strBody;<br />
<br />
SmtpMail.SmtpServer = "your.smtpserver.com";<br />
SmtpMail.Send(Message); <br />
bStat = true;<br />
}<br />
catch (Exception)<br />
{<br />
bStat = false;<br />
}<br />
return (bStat);<br />
}
Author of
The Career Programmer and Unite the Tribes
Know someone who desperately needs to get a clue?
Visit www.DownloadAClue.com and send them one!
|
|
|
|
|
I have a user control with labels on it.
But I need to get the click event. And since the backgroup is transparent I cant get a click.
Is there a hit test event i can do or something.
I tried MouseClcik and Click and it doesn't work
Thanks,
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
I vaguely remember it being possible to compare regions in GDI, and determine if they overlapped. Then use this value in a collision detection algorithm.
Is there a simple way to compare regions without using a graphics object? Or do i need to make bounding box maps and compare them?
Cheers
Tris
Update: I have regions which define the shape of objects. And depending on the entity that it represents, it will have a translation Matrix applied to it. I need a way to test whether two regions, with the relevant Matrix applied, overlap in any way.
This seems like a pretty fundamental requirement that should be doable without any kind of farting around with graphics handles etc.
|
|
|
|
|
i want to attach a database to sql server using C#?
my ordinary way to do this is to run this statments in Query Analyzer:
EXEC sp_detach_db @dbname = 'test'
EXEC sp_attach_single_file_db @dbname = 'test',
@physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\test_data.mdf'
but now i want to do this using c#!!!
thanx
|
|
|
|
|
Use a SqlCommand and ExecuteNonQuery()
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hi,
I have a Image object on the memory, now I want to convert this object to byte[] without saving it to harddisk!
How can I do this?
Thanks,
Hung
|
|
|
|
|
<br />
byte[] image_bytes = null;<br />
using (MemoryStream ms = new MemoryStream())<br />
{<br />
image.Save(ms, ImageFormat);<br />
image_bytes = ms.ToArray();<br />
} <br />
The Quran's Rational Arguments (Audio)
Background on Prophet Muhammad (in progress)
"They are MUSLIM. It does not matter how you split it up: all msulims (so they say) see every other muslim as a brother, regardless of origin or nationality." -legalAlien. Alhamdullah for the blessing of Islam
|
|
|
|
|
When i select any control(say button), the PropertyGrid does not does not display the "Name" property. How do i make this property available so that user can edit the "Name" property at runtime?
Note - Using System.ComponentModel and System.ComponentMOdel.Design namespaces
Navin
-- modified at 11:28 Monday 29th May, 2006
|
|
|
|
|
Hi All,
I have a function for example, Foo(). I am implementing a FileWatcher in my project and the watcher continuosly watches a particular folder for example c:\source. Now my problem is that when more than 1 files are created at a time in this source folder, i get uneven results. I have tried to use Synclock and monitor class but i could not implement it properly. I have called the Foo() method in the event OnCreated() event handler of watcher. When for example 6 files are copied and pasted to the source file at once, 6 events are fired. This makes uneven results. What i want is that When 6 files are created at once in source folder, the events should be called sequentially for each file.
Hope i am clear with my description. Any help would be appreciated.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
You may want to consider using the lock statement which is an exception safe way to provide synchronized access to a body of code. For example:
public void Foo()
{
lock (this) {
...;
}
}
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
-- modified at 18:17 Wednesday 31st May, 2006
|
|
|
|
|
Please don't double post.
---
b { font-weight: normal; }
|
|
|
|
|
Hi
I have one big solution containing C# and C++ projects.
There is a problem with compiling C++ files.
There are many errors like for example :
Error 26 error LNK2001: unresolved external symbol _fflush
Is it due to the fact that I have to choose environment settings for one language and I have chosen C#?
Is there any problem with compiling a solution containing projects in other languages in VS2005?
Thanks for help
Ela
|
|
|
|
|
Califgal wrote: And I am trying to access public method of 'TestClass' from Form1.cs file, but if I write
TestClass.
the intellisense doesn't show the methods I have created inside TestClass.
You have to create an instance of TestClass to see it's (non-static) public members. Type
TestClass x = new TestClass()
x. and you'll see your instance methods.
Share and enjoy.
Sean
|
|
|
|
|
Can anybody tell me how to verify a URL ...
i mean i need to check whether the url target exists or not
Thanks and Regards
Akhil
|
|
|
|
|
A url of what (http, ftp. pop3)? Or do you mean hostname?
|
|
|
|
|
hi.. thnx for the response.. its of HTTP Kind .
Actually i am trying to link to an image . i need to know whether that image exists or not .. hope ur reply fast
Thanx again
Akhil
|
|
|
|
|
System.Net.WebClient
|
|
|
|
|
Thanx a lot ... it works fine
|
|
|
|
|
hi,
Today just isn't my day.
Can anybody please tell me how you put a Double Quote into a string. I need this to send a command in Quotes to command Prompt Like this
"C:\Program Files\fop.bat"
Thank you in advance
He who laughs last...
|
|
|
|
|
textBox.text="\"C:\Program Files\fop.bat\"";
same logic can be used in ur case also .. try it
cheers
Akhil
|
|
|
|