this post might help:
http://www.webhostingtalk.com/showpost.php?p=5268640&postcount=2
you should just be able to add it to the end as an additional argument, it would seem...
this post might help:
http://www.webhostingtalk.com/showpost.php?p=5268640&postcount=2
you should just be able to add it to the end as an additional argument, it would seem...
Can you please elaborate a little bit more on what you're trying to do, exactly? We might be able to help if you clarify your question...
check this out, see if it provides any guidance:
http://blogs.msdn.com/codejunkie/archive/2008/09/13/bluetooth-device-control-development-using-c.aspx
There's any number of ways you can do this-- if you're not actually keeping track of users logged into the site, you can really only track things through IIS, like page hits per hour, etc, with some type of analytics software.
How are you keeping track of when users log in?
Thanks for your reply ....My project is a web - based application using ASP.NET and C# and it requires that the user should be able to import the excel data into the database ....becoz there are situations when the user has already the information stored in excel and he doesn't want to add the record again that's why my applications requires import option for importing ........ Actually I want to import all the fields of the excel into the two tables...but both table has many fields and there are only 5 columns which I need to export in those two tables and both tables has 10 fields and I need to export only 5 fields from the excel ....
...So what part are you having issues with? Do you not know how to use ADO.Net to read Excel, or write to a SQL server? We can't provide full-fledged code solutions like this-- it is fairly involved, like I mentioned.
Here are some Google searches that might help you out:
Reading Excel from C#:
http://www.google.com/search?q=C%23+read+Excel+file
Writing data to SQL server in C#:
http://www.google.com/search?q=insert+rows+SQL+C%23
can you provide a structure for the nodes? do you want embedded nodes or something?
There are a lot of different ways you could do this in LINQ to XML, especially if you return the XML elements as a query that has all of your XElements as an IEnumerable<XElement> set. You could even read in the entire document, query it OrderedBy in reverse, and then just read the top two...
It might not be ASCII-- are you certain of the codepage, or the encoding?
It really depends on how you want to do it. If you just wanted to get a list of a single directory's directories, you could populate a CheckedListBox and then only process the items in the CheckedListBox that are checked. If you wanted to get more in-depth than that, you would want to look into a TreeView that allows checked nodes.
Plenty of code samples are available on the internet for populating a TreeView based on a directory structure:
http://www.google.com/search?hl=en&hs=6IJ&q=treeview+directory+structure+C%23&btnG=Search
see if that helps.
Yes. If you write an application using .NET 3.5 libraries and functions, then the end user will have to install .NET 3.5 framework, in addition to the code you're deploying.
Fortunately, though, deployment packages make this easier, and can even facilitate downloading and installing the framework if the end user's machine does not have it.
Can you provide a code example? It could be that you're changing the time at which the SQLTransaction runs. I think there's a timeout that's based on the local time that the transaction is submitted...
Or, you can just instantiate the List with the ISingleResult:
ISingleResult<myType> isr;
List<myType> myList = new List<myType>(isr);
Either way should work, as the List<T>() constructor is overloaded to take any collection that implements IEnumerable<T>.
You need to use
System.IO.Compression namespace.
...But that only handles ZIP files. RAR files will have to be done with something else, like this DLL:
http://www.example-code.com/csharp/rar_unrar.asp
This won't create RAR files, but it will list and extract.
Sir this item add temptrarely,when i close my form thess item wel be delete i want parmanatle add,i hope you pick mt point.
What are you trying to load from? If you're trying to load the values from a database or an XML file, then you can use Databinding to bind the combobox to a data source, where you've added all of the choices in advance.
If you're not doing that, I don't quite understand your question-- adding a value at runtime via code is going to do just that-- add the value at runtime. Unless you institute some kind of persistence via an XML file or some sort of data source, you can't persist the choices in a combo box past when a user closes the application.
If you have a very large bunch of XML data, a string datatype isn't practical-- that string could potentially load hundreds of MB of data, risking a MemoryException being thrown if too much is loaded!
A stream is useful in many situations. I wrote a program that reads XML directly from a web service. The WebClient API returns that data as a stream, so that's how I read it in. Also, if you're doing an XMLReader instead of an XMLDocument, a stream is better suited, since you're going to be doing sequential reads from the XML stream, anyways. If you DO happen to read a large document, you minimize the chances of running out of memory. (XmlDocuments can still do this, though, so if you know you're going to be working with large documents, stick with the XmlReader).
Hope that helps! The big advantage to using streams is when you're working in a networked environment, like I mentioned.
Can you please show what work you may have already undertaken on this particular project? The code you're asking for is not really that "easy" to show, and it is heavily dependant upon the format of your spreadsheet, as well as the database schema you want to import into.
I suggest looking into ADO.NET's OleDB data model for loading to and from SQL and the Excel, and then look at SQL Management Objects (SMO) for creating the appropriate tables in your database.
But as an aside, why not use a tool that is good at doing this, like Business Intelligence Development Studio? You can program an SSIS package to run via C#.
You'll probably want to wrap it in an MSI package or something... You can't really install FROM an ASP.Net page like you're asking...
looks like you could have an error in your query syntax:
"Select * From Codes Where User ID = " +
probably needs to look like
"Select * From Codes Where [User ID] = " +
The "missing operator is probably the runtime complaining that you don't have an "=" that it expects after the token "User".
You may have to create a custom deployment package to do this-- the default MSI creator doesn't afford you many options, but the deployment package project does:
Can you set the purchaseUnits value artificially high and try stepping through it? This code genuinely looks like it should work just fine.
The only thing that I can think is that if you're using a custom Data Access Layer, there could be some limitation or bug within that.
Just to add to this:
If you're using reflection frequently because you have several classes that have the same method, you could consider casting those objects up to a defined interface. Say you have two classes, ClassA and ClassB. Both classes have a method called Run(), which you've defined in an interface called IRunnable:
public interface IRunnable
{
public void Run();
}
ClassA a = new ClassA();
ClassB b = new ClassB();
//casting up to IRunnable
IRunnable aR = (IRunnable)a;
IRunnable bR = (IRunnable)b;
//you could then pass these IRunnables to any method that takes an IRunnable as a parameter, for instance.
private static void MakeRun(IRunnable r)
{
r.Run();
}
MakeRun(aR);
MakeRun(bR);
...This is a really simple example, but I hope you get a good idea. You can do similar things with Interfaces that you can do with Reflection. I think it's cleaner to use Interfaces because you then have type-safety when executing those methods when returning values and inputting parameters.
Remove the object[] argument from your MoveUp() method. You don't need it.
Also, when you do the BeginInvoke, it should look like this:
MainForm.BeginInvoke(MoveUp, null);
a params object means you can have one or many objects as a parameter to pass to your method. The BeginInvoke feeds those objects to the method's signature, in case the method takes any. If the method you're invoking doesn't require any parameters, then simply use null. It's worked for me...
Have you dropped a debugger on that event to try and look at the call stack to determine exactly how that's being fired? It sounds like the tabpage or the textbox is actually losing focus every time, then when you highlight it, you get focus back.
Generally when I uninstall or install services via the MSI, I do all of it in the custom action portion. I would look at this:
http://msdn.microsoft.com/en-us/library/zt39148a(VS.80).aspx
for a little more information on the process. Also, does the user account you're installing with have full permissions to start and stop services?
Another thing to do, after you've made a reference to the DLL or project, is to use the using statement to include the namespace included in that DLL file. It's not absolutely required, but it does simplify using methods and classes from the DLL, rather than having to type out the fully qualified name of the method/class.
As a handy tip, you can use object explorer to look through a DLL's functions to determine what you're wanting to use.
How do you manage threads? are just you triggering and then joining them?
This link may help: http://www.cs.cf.ac.uk/Dave/C/node29.html i also work with threads, my matter is that threads needs to be concurrent (and they share information between them), just like small daemons inside the process.
Good luck!
Thanks!
The only thing concurrent about my threads, so much, is that they share a single text reader and text writer. I deal with that using the Synchronized() methods on each of those. The order I write the lines I'm processing to file don't matter much. It just matters they all get in.
I'm managing the threads "Automagically", I guess you could say. I'm using ThreadPool.QueueUserWorkItem to add jobs to the thread pool. Then the thread pool runs jobs as the threads become available. It's actually working now, which I found kind of funny... Still doesn't seem like the memory management issue is being addressed. But hey, in this case I'm just going to run with it for now, because it's showing results that are satisfactory enough... for now.
What's interesting is that I did take that approach, and it did seem to work. However, I had some concerns. What if say, 20 threads per core worked on one machine, but not on another?
I wound up using the ThreadPool. With a 4 core processor it made 1000 threads available. Oddly enough, it worked like a charm-- I didn't run into any Out Of Memory Exceptions. I know it could have been a fluke, so I'm still going to investigate a good way to manage memory in this environment. I don't want to have to write my own TextReader to properly seek when an exception happens, but if I must, I must...
Greetings all,
I'm actually proud to have a question I've never seen asked here. I've got a 1.5GB text file (YES, it's really 1.5GB) where each line needs a set of modifications. I've got the application running in a single-thread, whereby each line is read in, the modification is made, and the line is written back out.
This is fine, but it's slow. It took about an hour for the application to traverse this file. The IO itself is very fast, it's just the processing takes a second to do. So here's what I'd like to try:
While the reader has text in it, read a line.
Start a new thread to process the line, write the modified line to a file.
Sounds simple enough. The only thing is that each "line" could be anywhere from 1KB to a couple hundred MB a piece. This isn't a problem with the single-threaded application, but it is an issue when you're dealing with multiple threads, even on a quad-proc machine with 4GB of RAM.
Basically, I'd like to dynamically create a new thread to deal with each line that is in the TextReader. Once the thread finishes, it should write its data to file and release its resources. Past that, I'd like to consider a way to do it without using too much memory, or deal with OutOfMemory exceptions "cleanly", ie, without loss of data from the TextReader.
This might sound kind of complicated, I …
That's not right. You can't use WinForms code to do that in ASP.NET . There isn't a DialogBox control.
It's a little more complicated than that. The way I normally make a modal dialog box is to use the Modal Popup control in the AJAX.NET toolkit. You can build a panel, lay it out to look like a MessageBox, and then at the right time call an event to pop it up.
That's one way of approaching it. If you just want to pop up an informational Messagebox with little interaction, you could try using a JavaScript function or something.
Hi,
I have a form in which i want to update data if there is a repeated data in tne table. the table is in access, and i use: vb.net2003.
but i recieve the syntax error in update command. will you please help me:
objCmd = New OleDbCommand("UPDATE Table1 WHERE (cname=" & txtcname.Text & " AND network=" & txtnet.Text & ")) set(usb=" & txtusb.Text & ",cd=" & txtcd.Text & ",position=" & txtpos.Text & ",", New OleDbConnection(cmd))i put cname and network as key in the table.
thx
Hi,
Start your own thread with this question. That way, you'll get the information that you require, and you won't muddle up someone else's thread with a question that might not be directly related...
Hi,
1) Is it better to create one dataset for the whole project than many smaller (like one for each form)?
Depends. If you're using the datasets in the designer view, you really don't have THAT fine-grained of a control over when the datasets are instantiated, and how long they stick around in memory.
2) If I have 2 datasets, both has tableadapters that connects to the same data. Both table adapters load data to tables. Now, data in one of those tables changes and appropriate tableadapter updates the DB with it. Is data in second dataset also updated??
No. Even if the "source" of the data is the same, the Dataset is a completely different object that has its own contents. You have to update both datasets to have accurate contents.
3) I load, lets say, 1 column from DB to column of table that has tree columns (two stay empty). Now I use only data from that 1 column, but in some moment I need to load also the other 2 columns. If I use .Fill() method of appropriate table adapter will it reload the first column of the table even if it contains identical data as DB??
Please help me with these questions. They are somewhat important if I'm to write fast DB app.
You'd have to change the SelectCommand of the TableAdapter to get this new data. As such, it's a different Data set entirely. You could order them differently, or something.
…
You probably have to put the full path to the file. If the files are not in the same directory as the executable (which they're generally not if you just hit F5 and run from within Visual Studio), then just putting that file name won't work.
You don't have enough back slashes in there.
If it's a UNC path like this:
\\server\sharename\file.mdb
in C# it would look like:
"\\\\server\\sharename\\file.mdb"
or @"\\server\sharename\file.mdb"
the @ symbol will make it a string literal that doesn't need to be escaped with the extra backslashes.
do you get any error messages when this happens?
Char is 2 byte in .NET because that is how big a Unicode character is. The best thing to do is take the value in as a byte datatype and use the Convert.ToChar() method on that input value.
I just tried it with this code, and you'll see it produces an "H":
using System;
namespace Unicode_test
{
class Program
{
static void Main(string[] args)
{
byte myByte = 0x48; // 'H' in ASCII, single byte
char myChar = Convert.ToChar(myByte); // should still be 'H"
Console.WriteLine(myChar);
Console.ReadLine();
}
}
}
Hi there,
You need to look at ADO.NET. Specifically, you'll be looking at OleDB in relation to that.
It's kind of hard to give you a top-down model and explanation of ADO.NET here, but fortunately MSDN has a pretty good tutorial on it. Try searching there for some pointers.
Not necessarily a C# book, but "The Object Oriented Thought Process" was a great one for me :
Be careful with Pricewatch-- there's a bunch of bait and switch business going on there. They try to fight it, but you'll see some piece of hardware going CRAZY cheap, but then they'll throw exorbitant shipping fees at you...
Have you googled for that particular provider, ie, any issues surrounding it?
I'm not familiar with that provider, but it could be a limitation of it. I've used Jet and SQL just fine through OLEDB...
Why don't you have permission to install updates? Is your machine locked down or something?
Best route would be to contact your system administrator. They should authorize you to install the software if it's something you really need on there...
you can try this , which is the first to learn writing to the console.
using System;
public class myfirstprogram
{
public static void Main()
{
Console.Write("HELLO WORLD");
}
}
Hey there,
This looks suspiciously like a homework post. That's why I posted a link rather than code.
Teach them to fish, don't just give them the fish. :)
Here's what I mean:
//this
Console.Write("My line with a newline\n");
//is the same as
Console.WriteLine("My line with a newline");
What kind of errors are you getting when you append the \n ? Can you post your code?
Also, can you provide your connectionstring? I've never had these types of problems using OLEDB.
What type of database are you using?
What have you done so far? Can you please post the code you have thus far?
Generally, what you'd do is have a newline after each of those. Either insert a \n at the end of your line, or use Console.WriteLine() instead of Console.Write() if that's what you're doing.
This is a pretty tall order, actually. There's a lot involved in coding this type of text-editor. Generally it's called a WYSIWYG text area, and a number of companies offer them on a free or fee basis. The quality varies widely between them.
One that's apparently pretty popular is this:
I haven't used it yet, but I imagine you just drop it right into your project as a reference, and then use it as a custom control.
I guess it just has a .Text property like a regular TextBox, and you get back HTML code.
Jesus H. Christ... Does that represent a decline in morals with me saying that?
I do have a question, though... And I'm not trying to jump into this flame war, but instead provide some perspective... Does it really take all these 500+ word posts to respond back to a quip, or even to the subject at hand? Verbosity tends to be ignored, whereas someone can have greater impact by being succinct.
Simple facts have been presented here... Morals haven't declined. People are just raising their kids differently (or not at all) as compared to generations past. But every generation raises their kids differently. I think that the best measure of a generation's morals is to look at how that generation raises their young.
Is it rap music's fault? No. Whose fault is it? Nobody's, the way I see it: You are set on a course of who you are as a result of your upbringing and your surroundings, to an extent. Your experiences just about automatically shape your reactions to situations later in life. But then, magically, you are given free will when you become an adult. It's up to you to decide what's right and wrong, and live with those choices. It's that simple. Morals, or lack thereof-- there are just consequences.
Sounds like an awfully ambitious project for a beginner... Have the people requesting the application specified what requirements they need, exactly? That sounds like the best place to start...
Ok... your post wasn't so clear.... Yeah-- you can pre-compile the site... Even make a deployment project so the client can install the web app themselves...