|
I've played around with both approaches, and I just wrote an app that had to do a bunch of different queries. It turned out that it was simpler for me to write a method that used a SQLCommand and a data adapter with textual SQL to fetch the data and process it instead of a strongly-typed dataset and a data adapter created in the data designer. The first one took a little while, but then I could easily generalize to the other queries.
The thing you lose is the strongly-typed feature, and the graphical query designer. The first is a bit of an annoyance, but I tend to use enterprise manager for queries anyway.
YMMV
|
|
|
|
|
I try uploading a stream to a
textfile on a webserver. This is the code:
WebClient webClient = new WebClient();
Stream stream = webClient.OpenWrite
("http://localhost/accept/newfile.txt","PUT");
StreamWriter streamWriter = new StreamWriter(stream);
streamWriter.WriteLine("Hello world");
streamWriter.Close();
the example I am trying says the directory "accept" has to be writeable. I have tried various
permission settings but the webserver keeps saying it's unauthorized when
I run the example. Any ideas on what the proper settings should be ?
|
|
|
|
|
remember the webserver runs as a particular user - you need to give that user write permission to the directory you are trying to put the file in.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Yes, I asume the is IUSR_[MACHINENAME] and I gave this user write access to the "accept" directory.... It still gives me a 401 error
|
|
|
|
|
yes it is the problem of authority,did you try this URL: http://username:password@webhostname ???
If it still in trouble,you will have to use HttpRequest instead.
lost my way
|
|
|
|
|
aoa
The problem is how to display a picture, i.e we want to open a word document and want to get some picture if any and then to show it, now this is where the problem is we have opened word and got the picture from it but now problem is how to show it.
this is how we got the paragraph from word doc ,
Word.Range rngtext = aDoc.Application.ActiveDocument.Paragraphs.Item(2).Range;
MessageBox.Show(rngtext.Text);
now how to get show the picture?
Asim
|
|
|
|
|
You've only displayed code showing how to get a paragraph. Show us the code you used to get the picture.
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
I don't know why you can't figure out an easy way to get what you need. It's straight forward.
You don't know the MS Word object model ? I don't either, but who cares ?
Here is what I have done. I have opened MS Word, started the macro recorder, and inserted a picture. Then I edited the macro, and guess what? it showed me exactly the object used to manage pictures in Word. That's ActiveDocument.Shapes . You can either insert one of more picture, get an enumerator and get the pictures, etc.
Now that you know the right keyword to use, "Shapes", you could even start a google search and get a code snippet ready for use.
I hope that one answers not only your question, but also all others questions you may ask about the use of object models. Indeed, in our developer lives, what counts more is the ability to solve a problem regardless of the plumbering.;P
Back to real work : D-24.
|
|
|
|
|
Nice Rod.
Damn why didn't i think of that
May the Source be with you
Sonork ID 100.9997 sijinjoseph
|
|
|
|
|
Hello all CPians
I am developing on a machine with Word XP installed on, but the app I'm writing need to use the Word 9.0 library (interop). is there anyway to convince the VS.NET to dod that? I installed the MSWORD.OLB that has the Word 9.0 on my machine, but trying to add areference to it results inthe refernce being to the Word 10.0 library...
HELP!
Noam
Noam Ben Haim
Web Developer
Intel
noam.ben.chaim@intel.com
|
|
|
|
|
First remove the references from the VS.NET project. Save. You can make sure the references are actually removed by opening the .csproj file in a text editor.
Remove the interop libraries in both the Debug\ dir, and Obj\ dir.
Then open a command line, and type tlbimp <path>\msword.olb (isn't it msword9.olb by the way? I am not sure). This will produces several interop libraries.
Just add any of them to your project with the AddReference project menu option.
Back to real work : D-24.
|
|
|
|
|
Many thanks!!!
Noam Ben Haim
Web Developer
Intel
noam.ben.chaim@intel.com
|
|
|
|
|
Hi!
So I'm running my first web service on my winXP PRO
with Visual Studio .NET Architect and as I try to add
a web reference to my little WebFileUtil program,
the wizard tells me to establish some proxy server stting
from Internet Explorer.
I do that, and in the LAN settings I: give it the 1.1.1.1 adress
with the port 8080.
Now, it tells me that
it is not a common known web document and that the content type
application octet stream is not fine with them thank you very much.
The web service that i'm trying to plugged is written and into my system.
It uses a struct that contains the data in a byte array.
Help me! How can I get the web reference wizard to kindly plug the web service into my WebFileUtil ????
THanks!
Orlanda
Coding is a family business
|
|
|
|
|
a system is in logoff state and i am running my service on it and i want to login through my service how to do that ?
when i send some message the the service has to parse it and login the system?
is there any api available for login?
i have a network of simple two pc and i just need username and password and no domain.
plz tell api for login and its correct parameters ?
r00d0034@yahoo.com
|
|
|
|
|
Search MSDN for "LogonUser"
(this remains low-level, as far as I know there is no such thing provided by the .NET security namespace).
Back to real work : D-24.
|
|
|
|
|
i am running my service on a computer and i want to know wheather a system is in logoff or login state?
r00d0034@yahoo.com
|
|
|
|
|
I'm trying to get a synchronous connection to a server using the various .NET stream classes. It seems that I can send a command to the server successfully, but nothing is returned (or the StreamReader returns before the data can be read off of the socket). Here's the psuedocode/real code :
static void Main(string[] args)
{
string newsServerName = "msnews.microsoft.com";
int newsServerPort = 119;
TcpClient newsServer;
try {
newsServer = new TcpClient();
newsServer.Connect( newsServerName, newsServerPort );
}
catch( SocketException e )
{
string error = "Failed to connect to " + newsServerName + " on port " + newsServerPort;
Console.WriteLine( error );
Console.WriteLine( e.Message );
return;
}
NetworkStream netStream;
StreamReader reader;
StreamWriter writer;
try {
netStream = newsServer.GetStream();
reader = new StreamReader( netStream );
writer = new StreamWriter( netStream );
if ( reader.Peek() > -1 ) {
while ( reader.Peek() > -1 ) {
Console.WriteLine( reader.ReadLine() );
}
}
string sendMessage = "LIST" + "\r\n";
Console.WriteLine( "Sending message." );
writer.WriteLine( sendMessage );
writer.Flush();
Console.WriteLine( "Waiting for response." );
while ( reader.Peek() > -1 ){
Console.WriteLine( reader.ReadLine() );
}
}
catch( Exception e ) {
Console.WriteLine( "Error talking with server." );
Console.WriteLine( e.Message );
}
}
The last while loop never writes anything out. At the very least I should get the response from the server. How can I make the StreamReader wait until there is data before trying to dump out? I know this can be done with plain Send and Recv on a Socket, but I would like to use the Stream* classes if possible.
greg
|
|
|
|
|
Try this:
string line;
while ( (line = reader.ReadLine()) != null && line != "." )
{
Console.WriteLine( line );
}
NB: .\r\n is the signal for the end of the data.
|
|
|
|
|
i am using process class for my work?
is there any why to get current running thread and its id ?and its associated hwnd?
what are standaredinput and standaredoutput properties?
is there any online example where these properties are used if yes plz provide link?
may i get currently active window hwnd of type HWND using HWNDLE property of Process?
r00d0034@yahoo.com
|
|
|
|
|
Hi Imran,
The code for
http://www.codeproject.com/useritems/popupkiller.asp
has some hints towards this.
deepak
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
This is a general windows dev question, I couldn't find it in the docs or google. How in C# do I get ahold of the windows temp directory location? You know, c:\winnt\temp, or if someone's logged in it's Documents and Settings\<username>\temp... etc etc.. Is this a good place to store temp. files, or should I use my application's install directory?
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
In WIN32, it is :
DWORD GetTempPath(
DWORD nBufferLength,
LPTSTR lpBuffer
);
Easy to interop.
You could as well use WIN32 ExpandEnvironmentStrings , passing %TMP% as parameter.
Or read the registry, etc.
Back to real work : D-25.
|
|
|
|
|
System.IO.Path.GetTempPath() will return the current temp directory.
You may want to look at isolated storage[^] instead, especially if your app will be running in a locked-down environment.
|
|
|
|
|
Well said!
public static string System.IO.Path.GetTempPath() {
StringBuilder local0;
uint local1;
string local2;
new EnvironmentPermission(1).Demand();
local0 = new StringBuilder(260);
local1 = Win32Native.GetTempPath(260, local0);
local2 = local0.ToString();
if (!(local1))
__Error.WinIOError();
return local2;
}
Back to real work : D-25.
|
|
|
|
|
Bah! You need Anakrino to tell you that? I can read it in IL!
You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
|
|
|
|