|
please.. i need a sample... or please check if somethings wrong in this program..its not saving..and i think the connection string is not valid but it doesnt build any errors until you save in the database.
OleDbConnection connect=new OleDbConnection();
connect.ConnectionString="PROVIDER=DB2OLEDB; initial catalog=SAMPLE;integrated security=SSPI";
connect.Open();
OleDbCommand cmd_save =new OleDbCommand("INSERT INTO test(name,year,course)"+"VALUES("+"'"+textBox1.Text+"'"+","+"'"+textBox2.Text+"'"+","+"'"+textBox3.Text+"'"+")",connect);
cmd_save.ExecuteNonQuery();
connect.Close();
thanks for the help..
|
|
|
|
|
Check this to get some help with the connection string.
http://www.carlprothman.net/Default.aspx?tabid=86#OLEDBManagedProvider
But it sure seems odd that the error isn't raised when the Open() method is called. Must be the INSERT statement that's wrong. I don't know for sure if it's ok to write the ending ) of the data declaration without any space before VALUES( ... ) declaration.
I can also recommend you to start using SqlParameter to get a safer and smoother SQL handling.
Take a look here for a quick example:
http://www.samspublishing.com/articles/article.asp?p=27640&seqNum=6&rl=1
Hope it helps some
|
|
|
|
|
thanks.. its now running. But the problem is that i cant save data on the database. The exception is that the provider=DB2OLEDB is not available in the local machine.
it highlights the statement where i insert values. thanks.
|
|
|
|
|
and also the site that you give is not valid..
thanks..
|
|
|
|
|
I try to use
this.Text = "\u149d";
But I get strange character.
Thank You.
|
|
|
|
|
I am using the following code to draw an image. I want it to add to my page, the current code erases my page and only shows the image.
Bitmap draw = new Bitmap(500, 20);<br />
Graphics g = Graphics.FromImage(draw);<br />
<br />
g.DrawImageUnscaled(topleft, 0, 0);<br />
<br />
for (int i = 13; i <= intTableWidth; i++)<br />
{<br />
g.DrawImageUnscaled(contop, i, 3);<br />
}<br />
<br />
draw.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
Add a panel at design time and @ the position where you want to display the graphic.
and add creating this graphic, add this to the panel
Nana
|
|
|
|
|
How do I draw on a panel?
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
Dont draw on panel.
Whenever ur object g is ready,
just say pnlGraph.Add(g);
Nana
|
|
|
|
|
I am using WebControls, it does not have a method Add. How do I do it on a web panel?
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
pnlGraphic.Controls.Add(g);
Nana
|
|
|
|
|
Graphics is not a control.
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
send me entire code.
whats contop?
Nana
|
|
|
|
|
public void DrawBorder()<br />
{<br />
Bitmap draw = new Bitmap(intTableWidth, intTableHeight);<br />
Graphics g = Graphics.FromImage(draw);<br />
<br />
g.DrawImageUnscaled(topleft, 0, 0);<br />
g.DrawImageUnscaled(topright, intTableWidth - 12, 0);<br />
g.DrawImageUnscaled(bottomleft, 0, intTableHeight - 12);<br />
g.DrawImageUnscaled(bottomright, intTableWidth - 12, intTableHeight - 12);<br />
<br />
for (int i = 12; i <= intTableWidth - 12; i++)<br />
{<br />
g.DrawImageUnscaled(contop, i, 0);<br />
g.DrawImageUnscaled(conbottom, i, intTableHeight - 12);<br />
}<br />
<br />
for (int i = 11; i <= intTableHeight - 12; i++)<br />
{<br />
g.DrawImageUnscaled(conleft, 0, i);<br />
g.DrawImageUnscaled(conright, intTableWidth - 12, i);<br />
}<br />
<br />
draw.MakeTransparent(Color.Transparent);<br />
draw.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);<br />
<br />
g.Dispose();<br />
draw.Dispose();<br />
}
And
<br />
<br />
private Bitmap topleft;<br />
private Bitmap topright;<br />
private Bitmap bottomleft;<br />
private Bitmap bottomright;<br />
private Bitmap contop;<br />
private Bitmap conbottom;<br />
private Bitmap conleft;<br />
private Bitmap conright;<br />
<br />
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
I am working on an application that is a card based computer game. In the application there are playing cards made out of controls, and each of the control is an element of a control array. Each of the cards must be able to be a child to another card and/or a parent control to another card.
This creates a situation in which any control could be dragged onto another control based upon compliance with the rules of the game. However, the problem occurs when there is the capability to drag a parent control onto an already placed child control.
Here is the problem. When a child is dragged onto its parent control it generates the error: "A circular control reference has been made. A control cannot be owned or parented to itself."
How do I resolve this circular control reference or completely prevent the possibility of a child control from being dragged onto its parent in the first place?
The code for the DragOver event for each of the controls is as follows:
private static void _ctrlParent_DragOver(object sender, DragEventArgs e)
{
try
{
if ( DragDropHandler.CanDropHere((Control)sender, e.Data) )
{
Control cthis = (Control)sender;
e.Effect = DragDropEffects.Move;
Control ctrl = DragDropHandler.GetControl(e.Data, true, true);
if (!(ctrl is IDragDropEnabled))
{
return;
}
if (cthis.Name != ctrl.Name)
{
ctrl.Parent.Controls.Remove(ctrl);
ctrl.Parent = cthis;
cthis.Controls.Add(ctrl);
ctrl.BringToFront();
Point NewLocation = cthis.PointToClient(new Point(e.X, e.Y));
ctrl.Left = NewLocation.X - dragPoint.X;
ctrl.Top = NewLocation.Y - dragPoint.Y;
}
else
{
return;
}
}
else
{
e.Effect = DragDropEffects.None;
}
}
catch (Exception ex)
{
MessageBox.Show("Error is " + ex.Message);
}
}
NOTE: When the child control is dragged onto the parent control, both controls disappear from the screen because of the circular reference error generated. How is a test performed to prevent a circular reference when it is necessary to have the potential to be both a child and a parent control?
-- modified at 20:50 Sunday 25th February, 2007
|
|
|
|
|
Hi,
Does anyone know where I can find out how to change the colours of the column header row in a listview?
I can't find anything on the net at all.
Cheers,
Glen Harvy
|
|
|
|
|
I want to use an Xml file as my config file, i know how to read the data from the file, but wondering if there is a way to update just one field of the xml with out creating a new xml file. If someone can point me to an example or the xml command to use.
Thanks
Rob
|
|
|
|
|
Use the XmlDocument class, and an XPath with SelectSingleNode to find the node you want to update.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
In my efforts to teach myself the C# programming code, I want to collect as many C# Algorithms as I can
in my database, so I can develope as many small but useful programs as I can for my self and others who wish to share with me , and me with them.
Any great algorithms just sitting around, that I can capture and use.
Psudocode as well if possible.
Thanks much in advance.
Ron in Minneapolis, MN USA
Much success to you.
|
|
|
|
|
|
HI,
Hope i will be one in making your such database. That will certainly help to C# self Learners.
Could u please give me Name of few algorithm that u desirous to put in your database, So that i may send u some Code with Algorithm.
All the Best.
Binod K.
|
|
|
|
|
I want to add a dll, an API belongs to the software NETICA,i add him in References > Add References > Comtab > Netica object Library Ver 1.0;
What is that I has to not use the other thing? Knowing that this library is used C and C ++ there, there is an example C ++ which uses Netica.h, Netica.lib, Netica.dll and NeticaEx.h, the problem that when i write net_bn* net; who was true in C++, but he undeline error:The type or namespace name 'net_bn' could not be found (are you missing a using directive or an assembly reference?) , i know that they are a difference on C++ and C# syntax but the API was for C , C++ and C#
Thank you
|
|
|
|
|
The error message gives you the solution. It suggests that there is a reference or a using directive missing. As you have added the reference, it's the using directive that is missing.
---
single minded; short sighted; long gone;
|
|
|
|
|
Can you explain me, i don't know how i resolve this problem, thank you very mutch
|
|
|
|
|
Did you happen to notice all the using directives at the top of your code? You're missing the one that imports the namespace in the .DLL you referenced.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|