|
Ah, thanks very much!
This works. I already tried same as in the given code, but using the SetXXX method... well wrong choice >.<
Now it works perfect
--------------------------
xplo.re Project Management
http://www.xplo-re.com/
|
|
|
|
|
Hi guys,
I've been searching for this for 4 hours, but it just doens't seem to work.
I have an access database, and i have to add a column to it.
Here's my code:
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;" +<br />
@"Data Source=D:\My Documents\Visual Studio 2003.NET\VerboServe\Verboserve.mdb;" +<br />
"User ID=Admin;" +<br />
"Password=";<br />
OleDbConnection conn = new OleDbConnection(connString);<br />
DataSet ds = new DataSet();<br />
<br />
conn.Open();<br />
<br />
OleDbDataAdapter dataAdapter = new OleDbDataAdapter("SELECT * FROM Verbs", conn);<br />
OleDbCommandBuilder commandBuilder = new OleDbCommandBuilder(dataAdapter);<br />
<br />
dataAdapter.Fill(ds, "Verbs");<br />
<br />
ds.Tables["Verbs"].Columns.Add("Wouter");<br />
<br />
foreach (DataRow thisRow in ds.Tables["Verbs"].Rows)<br />
{<br />
thisRow["Wouter"] = "True";<br />
}<br />
<br />
commandBuilder.QuotePrefix = "[";<br />
commandBuilder.QuoteSuffix = "]";<br />
<br />
ds.AcceptChanges();<br />
dataAdapter.Update(ds, "Verbs");
Can anyone tell me how to do this?
Thanks,
Wouter
|
|
|
|
|
ds.AcceptChanges is marking all rows as normal. DataAdapter.Update searches for changed rows and updates them, then internally calls AcceptChanges . Since you're doing this yourself BEFORE calling Update , the Update method is NOT seeing any changes.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thankx for the info, but i am adding columns here, or is that the same?
|
|
|
|
|
You can't do it that way. You either have to issue an ALTER TABLE command or use a product-specific library to modify the database structure, like DDL for Access or SQL-DMO or SQL Server. This has been addressed many times before here. I suggest you click Search Comments and see some of the replies for more details and other ideas. While searching comments, you should probably also include the ADO.NET forum, too.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
|
i'm make Socket program
this is Receive file this img file, avi file..
but can't Receive XMLfiles
this is source
* Receive File info
================================================================
while(rData!=null)
{
byte[] rbuffer = new Byte[1024];
int rcount = rData.Receive(rbuffer, rbuffer.Length, 0);
string Cm = ed.GetString(rbuffer);
Cm = Cm.Substring(0, rcount);
Cml = null;
Cml = Cm.Split(':');
this.listBox1.Items.Add("Header Info");
this.listBox1.Items.Add("Data Type : " + Cml[0]);
this.listBox1.Items.Add("Data Name : " + Cml[1]);
this.listBox1.Items.Add("Data Length : " + Cml[2]);
if (Cml[0] == "Binnary")
{ FileReceive(rData, Cml);}
else if (Cml[0] == "Str")
{this.listBox1.Items.Add("String Value :" + Cml[3]);}
rData.Close();
rData = null;}
===================================================================
* Receive file
================================================================
FileStream fout = new FileStream(@"c:\youngTemp\" + cml[1]+"1",FileMode.Create, FileAccess.Write);
NetworkStream nfs = new NetworkStream(rData);
long DataSize = int.Parse(cml[2]);
long rby = 0;
try
{
while(rby < DataSize)
{ byte[] buffer = new Byte[1024]; int i = nfs.Read(buffer, 0, buffer.Length); fout.Write(buffer, 0, i); rby += 1;
}
this.listBox1.Items.Add("Success ");}catch(Exception ex)
{
this.listBox1.Items.Add("Error");
this.listBox1.Items.Add("Error is : " + ex.ToString());}
finally{
fout.Close();nfs.Close();
nfs= null;fout = null;}
=====================================================================
|
|
|
|
|
You should debug your code. An XML file is no different than a image file or an AVI - they are all just a stream of bytes. If your app treats them as such (And your code indicates that you do), then your app doesn't care - at the time of transfer - what is in the files themselves. XML files are not these special files sent from God, but just a formatted document, formatted accordingly to certain "guidelines" just like the various image codecs and AVI codecs.
The only problem I can see if your code is that you're writing out a binary file. Depending on how bytes are written or transfered, you may need to take file encodings into account. The only difference between the XML files you mention and the image and AVI files is that the former is a text file (ASCII, UTF8, Unicode, etc.) while the latter two are binary. There many be a problem in the way you handle text files. You should consider what FTP does, which is send such files using a text encoding while transfering.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
how to build a generic application which will take a table as a parameter
& do add,modify, delete operations on that table can some one offer a solution please !
Dileepa
|
|
|
|
|
You can't take a table as a parameter. You could take a table name or a filename with a DataTable (serialized as XML) in it. Then use commands in the System.Data namespace (like System.Data.SqlClient.SqlCommand or System.Data.SqlClient.SqlDataAdapter ) to do what you need. All the documentation is in the .NET SDK documentation and there are plenty of examples here on the CP site.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi i am making a program that controlling connecting to net, and ineed to detect connections which connected outside my program, i want to detect any connection on pc to find duration i didn,t find the way
|
|
|
|
|
How can I set page number in printing progress? Any property or trick?
Mazy
No sig. available now.
|
|
|
|
|
Handle the PrintDocument.PrintPage event and increment your printed page counter from 1 with each callback to your event handler.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks Heath. Is that possible to find out number of page before printing?
Mazy
No sig. available now.
|
|
|
|
|
That depends on you - it's your code generating and printing pages after all. If you're simply printing text, you can get the height of the font, factor in the extra line height (which you control) and margins, and measure the string to print. From that you could calculate the number of pages. If you're drawing pictures and what-not, you calculate the picture size multiplied by any zoom amounts (percentages).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks Heath. I got the point.
Mazy
No sig. available now.
|
|
|
|
|
I have a 50% transparent window that is on top of the desktop.
I want the user to be able to click 'Through the transparent window' onto objects behind it ... my computer.
The transparent window does not need force it just needs to be ontop of all the other windows.
another example is .. if you press alt-ctrl-del to bring up task manager how can i program the window to pass mouse clicks on it to the window behined it, if task manger is my program?
I hope this is clear enough to answer
|
|
|
|
|
Maybe it would help to enumerate the visible windows, find the window laying under your window but top of all other windows and the click point lies in it's client area and pass WM_* event message to the window...
Maybe there is another easier way to do that, but maybe this will help. Good luck ^^
--------------------------
xplo.re Project Management
http://www.xplo-re.com/
|
|
|
|
|
is it possible to write a multi-thread multicast server?
that mean one server can have many multicast group and serve different client?
any reference website about it??
thanks a lot!
|
|
|
|
|
Sure, why not? You can make a program do practically anything you want. Search CP for examples, or google the net with appropriate keywords. Mostly, if you use the same multicast port for the different threads handling different clients, send some sort of identifier (client name/version, etc.) so the proper thread can process it and others can drop it.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Is it possible to call functions in a C# dll from C++ code? If so, what do I set in the build properties of the C# dll to create the .lib the C++ code needs?
|
|
|
|
|
Tom, you may find my article Creating a CCW for COM enabled non .NET applications[^] helpful, it explains how to do this.
- Nick Parker My Blog
Last time I checked, all programmers have selective ignorance. I know nothing about 3D graphics. I know a lot about COM. VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done. - Don Box
|
|
|
|
|
My network is broken and has dynamic IPs. Not all computers can be seen and accessed by their names.
Is there a way to identify a server (or a computer) in such environment? I know that the best solution in my case is upgrading all computers to WinXP but that's not the issue now. That case makes me think if it is possible somehow to detect/identify specific computers (especially) servers quickly and reliably?
Any ideas?
|
|
|
|
|
|
I think this problem not in C#. You should get it into NetWork room.
Live for programming
|
|
|
|