|
hi
thank you for reply!
below is my code:
string SelectSchema = "SELECT * FROM [Package Data Range]";
DataSet ds = new DataSet();
OleDbDataAdapter adapterPkInfo = new OleDbDataAdapter(SelectSchema, ImportCon);
OleDbCommandBuilder cmdBldr = new OleDbCommandBuilder(adapterPkInfo);
adapterPkInfo.FillSchema(ds, SchemaType.Source, "PackageDataRangeSchema");
DataSet ds2 = new DataSet();
string selectPkInfo = "SELECT * FROM [Package Data Range]";
OleDbDataAdapter adapter = new OleDbDataAdapter(selectPkInfo, connection);
adapter.Fill(ds2, "Package Data Range");
ds.Tables[0].Merge(ds2.Tables[0],true,MissingSchemaAction.Ignore);
my dataet has around 200 columns. it is not efficient to repeat that....
thank you
zheng
|
|
|
|
|
shoubi wrote: it is not efficient to repeat that
Indeed, but as long as you want to insert all of them, you can loop through the columns and cobble up the Insert statement and parameters.
|
|
|
|
|
yup. thank you very much! however just want to check with you the "adapter.update()" how does it work? does it require any commands? or it is smart enough to act accordingly?
thank you!
|
|
|
|
|
It requires a SELECT command from which it (actually a CommandBuilder) can produce INSERT, UPDATE, and DELETE commands.
Generally, the data must involve one table, have a primary key, and not contain duplicates.
|
|
|
|
|
ok! thank you
|
|
|
|
|
Hi All
This post got actually 2 questions but related each other. I hope you can help me even just solving one of the 2.
In Windows I usually call NETSTAT to have information regarding the status of my network connections.
I am interested in getting the data below produced by Netstat using C#.
*Local Address
*The state of the connection.
Active Connections
Proto Local Address Foreign Address State
TCP ITA-2317A:3377 server1.mylan.co.uk:50506 FIN_WAIT_2
TCP ITA-2317A:3378 server1.mylan.co.uk:50507 FIN_WAIT_2
I am interested in catching the FIN_WAIT_2 state that sometimes is causing me some problems.
My C# application sometimes leaves the network connection in this state..do you know some possible workaround? I am using TcpClient class and I use Close() method..after I do this what check can I do to make sure that my connection is not in the FIN_WAIT_2 state?
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:17am.
|
|
|
|
|
Thanks! I am testing this right now..I have a small doubt bit trivial.
I use embed the NetworkStream in a StreamReader like this
NetworkStream aStream = _client.GetStream();
StreamReader reader = new StreamReader(aStream);
calling reader.Close() does it safely close also the NetworkStream
underlying or do I have to keep a reference to the NetworkStream and close it explicitly?
|
|
|
|
|
I'm trying to run this code within Visual Studio 2010, however, having set a breakpoint at line 39, the execution does not seem to get to line 39 where I have set a break point. As a matter of fact, when checking under Visual Studio 2010 Server Explorer > Servers > {puter name} > Application > ASP.NET 4.0.30319.0, there are no relevant events written. I also tried checking within the Windows Event Viewer. For Win XP (Control Panel > Administrative Tools > Event Viewer > Application sub node).
Is this a bug with .NET 4 or Visual Studio 2010? Does this issue happen to anyone else?
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Diagnostics;
public partial class ErrorTestLog : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void cmdCompute_Click(object sender, EventArgs e)
{
try
{
decimal a, b, result;
a = Decimal.Parse(txtA.Text);
b = Decimal.Parse(txtB.Text);
result = a / b;
lblResult.Text = result.ToString();
lblResult.ForeColor = Color.Black;
}
catch (Exception err)
{
lblResult.Text = "<b>Message:</b> " + err.Message + "<br /><br />";
lblResult.Text += "<b>Source:</b> " + err.Source + "<br /><br />";
lblResult.Text += "<b>Stack Trace:</b> " + err.StackTrace;
lblResult.ForeColor = Color.Red;
EventLog log = new EventLog();
log.Source = "DivisionPage";
log.WriteEntry(err.Message, EventLogEntryType.Error);
}
}
}
NOTE:
1. Beginning ASP.NET 3.5 in C# in 2008 - From Novice to Professional (ISBN: 978-1-59059-891-7) P.268 (306)
Jon
|
|
|
|
|
Does your exception block throw an exception? Do you have a generic exception handler? Does your IIS user have access to write to the event log? Did you use System.Diagnostics.EventLog.CreateEventSource and System.Diagnostics.EventLog.WriteEntry? (Probably not, since you new'd EventLog)
|
|
|
|
|
Does your exception block throw an exception?
No, but throwing the exception prior to calling the event log makes the logging code unreachable, and, this works fine within Visual Studio 2010.
Do you have a generic exception handler?
No, because it is not required for now.
Does your IIS user have access to write to the event log?
I am using Administrator on a local PC, what user does VS 2010 use (to confirm)?
Did you use System.Diagnostics.EventLog.CreateEventSource and System.Diagnostics.EventLog.WriteEntry? (Probably not, since you new'd EventLog)
System.Diagnostics.CreateEventSource is not even shown up within Visual Studio 2010, even though it's a static method. Problem with Intellisense maybe.
Jon
|
|
|
|
|
|
It's interesting. I'm noting that when I load my testpage on the browser (Google Chrome, Mozilla FF) the page remains 'waiting for cache...' when building it. Code here.[^] Screendump here.[^
Related links
Article 1[^]
Article 2
Jon
|
|
|
|
|
I have been using XNA for a while now and have gotten comfortable accustomed to its elegant design however a quick read on my upcoming University course shows that I will need to learn Direct X in C++ soon...
Would continuing to learn XNA benefit me for what awaits?
(I do know C++ by the way )
|
|
|
|
|
Yes, a lot of it works the same. Not everything though - XNA makes some things easier by hiding "the complicated stuff" if you do things the normal way. Of course, as soon as you need something out of the ordinary, things get dirty - such as setting up a non-default device on a non-default adapter (so it's hard to get it to work with PerfHUD and I never even got it working 100%).
The rendering itself is pretty much the same, but with less options in XNA.
|
|
|
|
|
Hi!!
i need to know about TSR(terminate and stay resident) programs in C#...
plz.. guide me...
i wanna learn how to make TSR programs in C#
|
|
|
|
|
TSR? I haven't seen that notion for the last 10 years. If you mean a program that loads once, and sits idle waiting to help you somehow, maybe visible in the task bar (with a NotifyIcon and a ContextMenu), yes those are just plain Windows applications. Examples are plenty here and elsewhere; I have one here: LP#TrayIconBuster[^]
|
|
|
|
|
Since Windows allows multiple programs to be loaded at the same time, TSR is no longer something special. Your C# programs are already TSR programs.
|
|
|
|
|
TSRs are rare (Extinct?) these days, I don't think it is possible in .net.
You can look at writing a service in .net (plenty of stuff on the Internet about .net services), this will probably achieve what you need.
[edit]
You can tell who the old people are on this forum, because we know what a TSR is !
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
My flight sim requires 620k of base memory do I don't like pesky TSR's.
|
|
|
|
|
Make sure you have sufficient EMS and XMS. And write the IRQ and DMA for your sound card on the side of the monitor...
|
|
|
|
|
Wow, I forgot all about that, kicking TSRs into upper memory with EMM386 when wanting to play F15 Strike Eagle. Happy days!
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
|
Dear all.
I want to access the user.config file from the installer itself, the problem is that I don't know how to get the path of the newly installed application. I know that the user.config file for my main application is somewhere in "'user'\AppData\Local\.... but I don't know how to access this area from the installer itself.
In my main application it is very simple, I just call:
Configuration _usrConfigLoc = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
Inside the installer I have tried:
Configuration _usrConfigLoc = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal); This returns the path of the config file of the installer (and not my main application)
Does anybody have a way to find the freshly installed user.config file from the installer application?
|
|
|
|
|
protected override void OnAfterInstall(System.Collections.IDictionary savedState)
{
string t_path = this.Context.Parameters["assemblypath"].ToString();
Configuration _usrConfigLoc = System.Configuration.ConfigurationManager.OpenExeConfiguration(Path.Combine(t_path,"user.config"));
base.OnAfterInstall(savedState);
}
|
|
|
|