|
A really good book I found was "C# for Dummies". Easily can get hold of via the web or at a book store.
|
|
|
|
|
Helo Every 1,
I want to receive files via MODEM and files are being transferred by XMODEM. I am using C# and want to receive files from different MODEMS.
What is the way to receive and send files by XMODEM using c#? I can do it by Hyper Terminal but I want to do it in my code.
Any Suggestion will be very helpful..
Thanks in advance..
Regards,
-SIFAR.
|
|
|
|
|
|
I have been hunting for over a week to understand xml. I have no Idea why the concept of how to use it alludes me. Sorry in advance. This is a real noob question.
I have built an application that manages the installation and updates several of our packaged products. The problem is All the settings are stored in sql tables.
I just need to understand is:
1)How to create a XML file that stores the connection string
2)How to refer to that XML file to use the connection string in the application.
3)If the file gets deleted, how to have the application recreate a template with a default connection string.
My Application is C#
Any information directly or indirectly would greatly be appreciated. This project needs done by the end of the week. And this is the only part I can not figure out.
mgeorge@peerassistllc.com
modified on Tuesday, June 23, 2009 11:05 PM
|
|
|
|
|
JollyMansArt wrote: 1)How to create a XML file that stores the connection string
2)How to refer to that XML file to use the connection string in the application.
You can use application configuration file (app.config ) for that. It is in XML format. There is a appSettings[^] element where connection strings can be stored. ConfigurationManager.AppSettings gives you access to this element.
|
|
|
|
|
I tried that but I can not seem to get the value to return properly... Here is what I do..
I go to the application project manager,
right click on project
Say properties
Go to the settings tab and put
Name: SQLConnectionString
Type: string
Scope: Application
Value: "Data Source=PA-DEVPLATFORM1\SQL2005;Initial Catalog=AppLoader;Persist Security Info=True;User ID=Mike;Password=zephyr"
This SQLConnection String I am wanting in a external XML file editable to the end user so I do not have to recompile the application for every sql server change.
Here is the code I am using to call it. It does not work.
SqlConnection conn = new SqlConnection(Properties.Settings.Default.SQLConnectionString);
I can not seem to get
ConfigurationSettings.AppSettings
to be identified as a valid command...
I got close by adding
public static NameValueCollection AppSettings { get; }
but the applications says it needs a set added to it.
PLEASE any help on this?
----------------------------------------------------------
So far I have figured out to get the setting I think I need to do this?
SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["SQLConnectionString"].ToString());
But it still comes back saying the string is null... Why?
modified on Wednesday, June 24, 2009 1:54 AM
|
|
|
|
|
Got it....
string testanswer = PeerAssistLoader.Properties.Settings.Default.SQLConnectionString.ToString(); //["SQLConnectionString"].ToString();
MessageBox.Show(testanswer);
I had the value in the settings with quotes around the connection string. Since I was viewing that field as a string value. Now I know better...
modified on Wednesday, June 24, 2009 2:16 AM
|
|
|
|
|
JollyMansArt wrote: I am wanting in a external XML file editable to the end user
If you want it editable by the end user, I would create my own using XMLDocument - there is a big risk of the user damaging other application settings by mistake if he is encouraged to edit the app.config file directly.
See Here[^] for an example.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
As Navaneeth says above, you probably want to use an app.config file for storing your connection string.
There are two ways of storing the connection string in said file.
The first is quick, dirty and I don't like it, but I'll show you anyway...
The connection string can be stored within the "appSettings" section of your app.config file, as follows:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="MainDB" value="Data Source=127.0.0.1;Initial Catalog=MainDB;User ID=usr;Password=pwd"/>
</appSettings>
</configuration>
To then read this setting from within your c# app, you'd need to use the following code:
System.Configuration.AppSettingsReader reader = new System.Configuration.AppSettingsReader();
string connString = (string)reader.GetValue("MainDB", typeof(string));
The reason I don't like the above method, is because the app.config specification includes a section specifically for connection strings.
Below is an example of an app.config that uses this section:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="MainDB" providerName="System.Data.SqlClient" connectionString="Data Source=127.0.0.1;Initial Catalog=MainDB;User ID=usr;Password=pwd"/>
</connectionStrings>
</configuration>
To then read this section, you first need to add a reference to "System.Configuration " to your project.
Then, you can use the code below:
string s = System.Configuration.ConfigurationManager.ConnectionStrings["MainDB"].ConnectionString;
Much nicer
|
|
|
|
|
|
Hi all,
I am trying to get the following input data using http post .
i have my asp.net Page reading the data as :
if (Request.QueryString["customer_fname"] != null)
fname = Request.QueryString["customer_fname"];
the value of fname is test.However,Its alwyas having a null string.
IS it not getting the http post for the above html?
Can any one advice Please?
Thank you in advance
modified on Tuesday, June 23, 2009 7:10 PM
|
|
|
|
|
Hidden field, use Request.Form instead:
string fname = "";
if (Request.Form["customer_fname"] != null)
{ fname = Request.Form["customer_fname"]; }
Response.Write("fname value: " + fname);
Regards,
Gary
|
|
|
|
|
can someone put a code snip here that i can use to determin if a adusers is disabled
|
|
|
|
|
|
i tried this method to see if i could figure out if the user was disabled but i get and error i just wanted to see if i would get a 0x1 if the user account is not disbled and a 0x2 if it was
public void Disable(string userDn)
{
try
{
DirectoryEntry user = new DirectoryEntry(userDn);
int val = (int)user.Properties["userAccountControl"].Value;
\\ get the error on the above line
user.Properties["userAccountControl"].Value = val | 0x2;
//ADS_UF_ACCOUNTDISABLE;
}
catch (System.DirectoryServices.DirectoryServicesCOMException E)
{
//DoSomethingWith --> E.Message.ToString();
}
}
|
|
|
|
|
This is what I use passing in the DirectoryEntry object as a paramater.
public static bool CheckAccountDisabled(DirectoryEntry de)
{
int ACCOUNTDISABLE = 0x0002;
int flags = (int)de.Properties["userAccountControl"].Value;
if (((flags & ACCOUNTDISABLE) == ACCOUNTDISABLE))
{
return true;
}
return false;
}
modified on Thursday, June 25, 2009 6:02 PM
|
|
|
|
|
I've just started getting this for every breakpoint within a specific assembly.
"The breakpoint will not be hit, no symbols have been loaded for this document" I'm using a debug build, so what happened?
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
Delete everything in your debug folder and clean your solution and rebuild, happens to me occasionally. This usually fixes it.
|
|
|
|
|
Not this time.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
You deleted your .pdb files as well? Close VS, delete pdb and binaries, open, clean solution and build.
Should solve it. Has to do with timestamps of builds not being updated, IIRC that info was held it the pdb files, deleting them, reopening VS with a clean solution / build solved it.
Give it another whack.
|
|
|
|
|
Yes.
I deleted the following folders with the solution closed:
<all projects="">\bin\debug\
<all projects="">\bin\release\
<all projects="">\obj\
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
Sorry, that's what did it for me if I remember correctly. I can't remember if I deleted the .suo and .ncb files as well, but that might damage your solution and I don't want to corrupt your data.
|
|
|
|
|
I would do a rebuild all and see what happens.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Assuming you meant rebuild solution that didn't work.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
Assuming you deleted all the files, that must mean that you're sure the exe you're running, is being build every time ?
I'd love to know what the root cause is, it sounds quite bloggable. ( http://thingsihateaboutmicrosoft.blogspot.com/[^] )
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|