|
To update multiple rows, you need to use the UPDATE command.
UPDATE [Table]
SET [Column] = [Value]
WHERE [Condition]
|
|
|
|
|
Thanks for your reply
But i am already using this syntax.Still my problem is how to update multiple rows of a single column with different values at runtime from C# using update query
Regards
Usman Ahmad
|
|
|
|
|
Dear Sirs,
What are people using now for their 3D rendering in C#? I see that the last managed DirectX is a little old now, and it looks like the managade libraries for OpenGL are a little old, too. Is there one of the above that's good and new that I've missed? I am using XNA, but it's very limited. For instance, I would like to render two panels in a form, and I don't see a way to do that...I just looked it up, and see a way to do that, so I'll rephrase: So, is everyone using XNA now? It seems very easy to use, and meets most needs. I'm creating medical imaging programs and would like to have lots of control over coordinate systems, and drawing many panels at the same time on the screen.
Let me know what you think! Thanks.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
XNA is not limited. What exactly are you trying to do?
|
|
|
|
|
Dear Mr. Aptroot,
Well, I'm just trying to poll users as to their preferences and current usages. I've really gotten my 3D rendering under control. I'm showing a structure set for radiation treatment, and showing where the beam intersects the patient given a certain radius and sample rate. I got that done, but I guess I'll be making more programs sort of like this one, and I was wondering if I should investigate other options. In my original post, which was surely pretty confusing, I admitted that it wasn't limited (after looking something up that I thought was a limitation). So, I guess you use XNA?
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Yes, but I've also used Managed DirectX (which is pretty much the same as XNA without the fancy extra's) and OpenGL and native DirectX
What do you really want to do though? (I don't know much about the medical stuff)
|
|
|
|
|
Dear Mr. Aptroot,
I must be particularly unclear today. I have the rendering under control, that is, I am done doing what I wanted to do, and now I don't have anything in particular that I want to do. What I WANTED to do was show a body on the screen and allow the user to investigate various structures in the body (the skin, internal organs, tumors, etc.), but I did it in XNA.
The reason I'm polling for other users' preferences is because I am sure I'll be doing more and I'm wondering if anything might be better. Thanks for your persistent help!
When you say Managed DirectX are you talking about that one like DirectX 9? Or are you referring to SlimDX? When you say OpenGL, are you accessing it through the .net, or native? Thanks again.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Oh you're already done, that's nice
I meant the managed part of DirectX 9, I've used OpenGL both natively and through the Tao framework but found it easier to work with in a native environment, but that's just an opinion of course
|
|
|
|
|
Hi Dear all.
I`m not a C# programmer , but I manage to make a little email Pop3 reader searching in the internet. This program has a timer and every 5 min looks into an email account and read and download some information. Now what I need is the possibility to read mails from more than one email account at the same time. IE, if I have two Gmail account, the program should look into this two account every 5 min and download the info I need. Please, anyone that help me on this. I´m using Higuchi.net lib for connecting to email accounts, it´s a very good one, anybody can google it and download it, it is free. I have tried multithreading but with no luck. My code is the following:
public partial class Pop3 : Form
{
public Pop3()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (this.checkBox2.Checked != true && this.checkBox3.Checked != true && this.checkBox1.Checked != true)
{
MessageBox.Show("Select a Conection Option");
}
else
{
timer1.Tick += new System.EventHandler(this.OnTimerTick);
timer1.Enabled = true;
timer1.Start();
this.button1.Enabled = false;
}
}
private void OnTimerTick(object sender, EventArgs e)
{
if (this.checkBox2.Checked == true)
Gmail();
if (this.checkBox3.Checked == true)
Gmail2();
if (timer1.Interval != 360000)
timer1.Interval = 360000;
}
private void Gmail()
{
Pop3Client cl = new Pop3Client();
cl.UserName = "xxxxxxxxx@gmail.com";
cl.Password = "xxxxxxxxx";
cl.ServerName = "pop.gmail.com";
cl.Port = 995;
cl.AuthenticateMode = Pop3AuthenticateMode.Pop;
cl.Ssl = true;
cl.Authenticate();
if (cl.Available == true)
{
if (cl.ReceiveTimeout <= 10000)
{
if (cl.State == Pop3ConnectionState.Authenticated)
{
if (Convert.ToInt32(cl.GetTotalMessageCount()) >= 1)
{
try
{
int ncount = Convert.ToInt32(cl.GetTotalMessageCount());
for (int i = 1; i <= ncount; i++)
{
Pop3Message mg = cl.GetMessage(i);
string MyText1 = mg.BodyText;
Parse(MyText1);
}
for (int i = 1; i <= ncount; i++)
{
cl.DeleteEMail(i);
}
}
catch (Exception e)
{
throw new Exception(e.Message);
}
}
}
else
{
popup mypop = new popup();
mypop.Show();
mypop.Refresh();
}
}
}
cl.Close();
cl.Dispose();
}
private void Gmail2()
{
Pop3Client cl = new Pop3Client();
cl.UserName = "xxxxxxxx@gmail.com";
cl.Password = "xxxxxxxxxxxx";
cl.ServerName = "pop.gmail.com";
cl.Port = 995;
cl.AuthenticateMode = Pop3AuthenticateMode.Pop;
cl.Ssl = true;
cl.Authenticate();
if (cl.Available == true)
{
if (cl.ReceiveTimeout <= 10000)
{
if (cl.State == Pop3ConnectionState.Authenticated)
{
if (Convert.ToInt32(cl.GetTotalMessageCount()) >= 1)
{
try
{
int ncount = Convert.ToInt32(cl.GetTotalMessageCount());
for (int i = 1; i <= ncount; i++)
{
Pop3Message mg = cl.GetMessage(i);
string MyText1 = mg.BodyText;
Parse(MyText1);
}
for (int i = 1; i <= ncount; i++)
{
cl.DeleteEMail(i);
}
}
catch (Exception e)
{
throw new Exception(e.Message);
}
}
}
else
{
popup mypop = new popup();
mypop.Show();
mypop.Refresh();
}
}
}
cl.Close();
cl.Dispose();
}
private void Parse(string xtext1)
{
string[] xxValues = Regex.Split(xtext1, "\r\n");
for (int j = 0; j < xxValues.Length; j++)
{
string vf_values = xxValues[j].ToString();
if (vf_values != "")
{
string[] values = vf_values.Split(new char[] { ' ' });
string date = values[0];
string time = values[1].Remove(values[1].Length - 1);
string unit = values[2].Remove(values[2].Length - 1);
string clock = values[3];
string speed = vf_values.Substring(vf_values.Length - 11, 8);
string xSpeed;
string cSpeed = "";
for (int i = 0; i < speed.Length; i++)
{
xSpeed = speed.Substring(i, 1);
Regex re = new Regex(@"\d+");
Match m = re.Match(xSpeed);
if (m.Success)
cSpeed += xSpeed;
}
conexion con = new conexion();
con.Insert(date, time, unit, clock, cSpeed);
con.closingcon();
dataGridView1.Rows.Add(1);
dataGridView1.Rows[j-1].Cells[0].Value = date;
dataGridView1.Rows[j-1].Cells[1].Value = time;
dataGridView1.Rows[j-1].Cells[2].Value = unit;
dataGridView1.Rows[j-1].Cells[3].Value = clock;
dataGridView1.Rows[j-1].Cells[4].Value = cSpeed;
dataGridView1.FirstDisplayedScrollingRowIndex = j;
dataGridView1.Refresh();
dataGridView1.CurrentCell = dataGridView1.Rows[j-1].Cells[0];
dataGridView1.Rows[j].Selected = true;
this.textBox1.Text = j.ToString();
this.textBox1.Refresh();
}
}
dataGridView1.FirstDisplayedScrollingRowIndex = 1;
dataGridView1.Refresh();
dataGridView1.CurrentCell = dataGridView1.Rows[1].Cells[0];
dataGridView1.Rows[1].Selected = true;
}
private void Pop3_Load(object sender, EventArgs e)
{
dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("Tahoma", 9, FontStyle.Bold, GraphicsUnit.Point);
dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = SystemColors.ControlDark;
dataGridView1.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
dataGridView1.DefaultCellStyle.Font = new Font("Tahoma", 8, FontStyle.Regular, GraphicsUnit.Point);
dataGridView1.DefaultCellStyle.BackColor = Color.Empty;
dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = SystemColors.ControlLight;
dataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.Single;
dataGridView1.GridColor = SystemColors.ControlDarkDark;
}
}
|
|
|
|
|
You don't need two methods Gmail1 and Gmail2 . Keep only one method and that method should accept the necessary details required for connection. You need to start two threads and execute the method. If you have any shared data that both threads will read/write, you need to use lock.
When accessing controls from worker threads you need to use Invoke /BeginInvoke to avoid cross-thread errors. This[^] ebook should help to get started.
Best wishes,
Navaneeth
|
|
|
|
|
|
Perhaps this would be more soapbox / lounge material, don't you think??
|
|
|
|
|
You are just not my type.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
|
And that is why you provide an e-mail link?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I was new and uneducated! Now I have to block his emails (8 so far in 10 minutes) and remove the link.
|
|
|
|
|
We have a flood of unusually clueless people right now. I suspect they are mostly CSS.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
hi
i developed an application that used a datagridview to show the records and it will frequently update (insert a record or delete a record)
some times datagridview will crash and show me a big red sign (like a big "x") on the full client rectangle of itself!
i do not know what is going on and what statement cause this problem and how can i prevent the problem?
what should i do ?
thanks in advance...
|
|
|
|
|
I'd suggest debugging.
PS Liquid Nitrogen will do also.
|
|
|
|
|
i have done that with simple debugging but the problem still persists and i do not know what should i do and what cause this problem
please explain me more
|
|
|
|
|
I have the same problem
|
|
|
|
|
and at last i get the answer:
in fact , there is a malicious thread that want to access my DataGridView !
some thing like a high frequently repeatable time tick or ...
in fact i had to use this.Invoke() with parameters that will rise the update DataGridView Method!
i used the fallowing solution!
delegate void AddDatevalueHandler(object[] newRow);
delegate void DeleteDatevalueHandler(string deletedRow);
.
.
.
private AddDatevalueHandler AddHandler;
private DeleteDatevalueHandler deleteHandler;
.
.
.
AddHandler = new AddDatevalueHandler(AddData);
deleteHandler = new DeleteDatevalueHandler(DeleteData);
.
.
.
object[] param ={ NewRow };
this.Invoke(AddHandler, param);
.
.
.
private void AddData(object[] NewRow)
{
dataGridAlarms.SuspendLayout();
ds_main.Tables[0].Rows.Add(NewRow);
dataGridAlarms.ResumeLayout(true);
}
private void DeleteRow(string ID)
{
dataGridAlarms.SuspendLayout();
this.Invoke(deleteHandler, parameter);
dataGridAlarms.ResumeLayout(true);
}
good luck
|
|
|
|
|
I have a question about GUID. I created a calender admin program that stores event data in an xml file. The xml file consist of an element called call ID. I am using ID as a key. Each event has a unique id.
My code generates a GUID for each new event. Currently I set up a method in my code behind to see if the GUID exist before I except the value of the new GUID. My understanding the sytem should generate a unique GUID each time you create one. I am thinking it is possible to get a duplicate GUID value, for example if I move the application to a new server.
Is this good practice or just a waste of resources?
Thanks,
David
|
|
|
|
|
Better safe than sorry.
I generally use a database, so the GUIDs I generate as primary keys gets checked by the database engine. But, yes, they do get checked and an Exception will be thrown if a duplicate is ever detected.
If you are creating your own database, you should perform the check.
|
|
|
|
|
According to MSDN (Remarks)[^], GUIDs are as globally unique as possible. The probability of seeing two the same in the world (universe?) is very low. The probability of seeing two the same on a single PC is infinitesimal. Your process looks fine, if you hit a duplicate then just generate a new one and continue. Alternatively you may like to consider a simpler key, such as time and date, sequence number, combination of the two etc. It all depends on how many items you expect to be storing.
|
|
|
|