|
Hi,
I have working C# winform application ,
I need access the database name userid,password in
variaus sysetems SQL Server's current DB Name UID, PWD
thanks,
Senthil Kumar
|
|
|
|
|
What is the exact problem? It is not really clear.
What have you tried, where are you stuck?
Please improve the question if you want us to help you.
|
|
|
|
|
My Question is How to change the connection string externally... i use a txt file and change the uid,pwd in client place... is there any other ways to set the sql DB,UID,Pwd
thanks
|
|
|
|
|
You can use the web.config or app.config files for that. They are accessed through the ConfigurationManager class.
They are XML based files and have several sections that ConfigurationManager can read. One of those sections is "ConncectionStrings" (or something similar.)
See here[^] and here[^] and here[^]
hope this helps.
|
|
|
|
|
You're going to have to be a lot more specific about what you're looking for. A database in SQL Server doesn't have a username and password. Even if it did, there's no way for you to get the password for any SQL Server account.
|
|
|
|
|
My Question is How to change the connection string externally... i use a txt file and change the uid,pwd in client place... is there any other ways to set the sql DB,UID,Pwd
thanks
|
|
|
|
|
A connection string is just a string of characters. If you need to change the userId and password used to connect to the database, just create your connection string and inclue easily replacable tabs where the username and password would normally go. Then it's just a very simple search and replace for those tags. For example:
Server=SomeSqlServer;Initial Catalog=SomeDatabase;Username={USERNAME};Password={PASSWORD}
Then you just replace the "{USERNAME}" and "{PASSWORD}" strings with their actual values:
string connString = configurationConnectionString.Replace("{USERNAME}", username).Replace("{PASSWORD}", password);
|
|
|
|
|
Hi,
I have a Windows Form application which connects to MySQL database.
In connection string, do you recommend to use the root as user or create a different user or have a separate MySQL user for every user in the company?
and does it make any difference in performance and security of my .NET WinForm application?
Technology News @ www.JassimRahma.com
|
|
|
|
|
We DO have a database-forum.
|
|
|
|
|
Using the root account for application access in any DB system is a very high security risk and doing so will probably get you fired as a developer.
Create an account in the DBMS specifically for your application to use and give it permissions to only the objects and accesses that it needs.
Does it make any difference in performance?? No. It's just an account that provides access to things.
Does it effect the security of your application?? No, but it DOES effect the security of the data you put in the database(s).
|
|
|
|
|
Jassim Rahma wrote: do you recommend to use the root as user
Definitely not.
Jassim Rahma wrote: or create a different user
Yes.
Jassim Rahma wrote: or have a separate MySQL user for every user in the company?
No.
|
|
|
|
|
Hi all,
I was just reading the following article Introduction to NUnit... and was introduced to Attributes.
I'm a noob so I've never seen this before or read about it. I understand that it allows you to define metadata within your program and so on...
My question is more so about format than understanding. I was wondering if I put in an attribute right above on function if that attribute is assigned to all functions below it until another attribute is reached.
For instance:
[SetUp]
public void init()
{
Person person = new Person();
}
public void foo()
{...}
Will the attribute [SetUp] be for both init and foo, or just init?
Thanks,
Jeramy
|
|
|
|
|
The [SetUp] attribute was placed above init - consequently, only the function init has that attribute.
By the way, with NUnit, you need a [TestFixture] above your class declarartion, a [TestFixtureSetUp] for the test setup method (if availbale), and a [Test] for every actual test method - the attributes differ between Microsoft Test and NUnit. You can use Visual NUnit for running your tests from Visual Studio (has some bugs, but it's still easier than using the NUnit GUI).
|
|
|
|
|
Hi all,
I am passing a string parameter to one of the method of web service.
This string parameter has /r and/n incorporated in it, but when value is passed to web service it removes /r from it.
Any reason why is it happening so.
Web service is created using .Net framework 1.1 and written in C# code.
I am trying to consume web service in an another application build using framework 1.1.
Rock Star
|
|
|
|
|
Do you have the source code of that web service?
Is it running on some OS where new lines are not \r\n but \n only? (Assuming that you actually meant \r and \n when you wrote /r and /n...)
|
|
|
|
|
If you want to have the \r and \n come across as literals (not return and newline), then you need to escape them before they get to the server. You can do this in two ways, either:
string escapedString = "This is my escaped \\r and escaped \\n value";
or
string escapedString = @"This is my escaped \r and escaped \n value";
|
|
|
|
|
Probably depends on what "parameter" means but presuming that you really do have a web 'method' and you are passing data in the body, not url, and the server is discarding it then there is nothing that you can do on the client side that will stop that unless you can find a server side feature that allows it.
As per the other suggestion the server might allow escaping but that won't help unless it actually converts the value to the appropriate character. If it doesn't then it will return with the escape intact which won't help you.
Of course if you can modify the server then that would solve it.
|
|
|
|
|
I am writing a new C# 2010 desktop applicaton. I am using some of the exsting code in another C# 2010 application to start the new application since I will be using alot of existing code that works. I basically want to have a desktop form where the user can enter some data and return to the statement after 'Application.Run(new RejectForm());' listed below.
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new RejectForm());
}
I would like to have the data that was entered in the form be available to the application at this point.
Thus can you tell me the following:
1. How can I return to the location right after the Application.Run(new RejectForm()); statement?
2. How can i have the values that were entered on the windows form be available for the rest of the application to access from this point?
|
|
|
|
|
Not sure I understand fully, but here goes. Application.Run sets up the message loop which 'runs' the form, so when the form is closed that statement ends. Normally the application terminates there as well.
If you want to do some post processing create properties or retrieval methods on the form then just access them after the Run method has completed. When main() ends, so does your application.
Regards,
Rob Philpott.
|
|
|
|
|
static void Main(string[] args)
{
using (var f = new RejectForm())
{
if (DialogResult.OK == f.ShowDialog())
{
string someValue = f.TheValue;
}
else
{
}
}
}
You'd need public properties in your RejectForm , similar to the code below;
public class RejectForm: Form
{
public string TheValue
{
get { return theValueTextBox.Text; }
}
}
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
How would you incorporate the code you listed above in the windows form and then have the code return to the main method?
|
|
|
|
|
classy_dog wrote: How would you incorporate the code you listed above in the windows form The first part goes into "Program.cs"; you can see the Main-method. The second part of the code goes in the form you're trying to show.
classy_dog wrote: and then have the code return to the main method? That would happen automatically; when an application is run, the Main-method is executed. The code as presented would display a form (modal), and continue execution on the line after the "ShowDialog" call, as soon as the form closes.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
There is one more thing to that. You would have to put
DialogResult.OK; when you want to close Form, in order to
DialogResult.OK == f.ShowDialog() be true.
Best regards,
|
|
|
|
|
As specified in above comment, I neglect to mention I'm assuming an "OK-button" on your form, with the property "DialogResult" set to "OK".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi folks,
What I need is some guidance on what .NET namespaces o classes or whatever may be helpful to accomplish what I need to build.
Basically I have to build an Desktop (or Web) application capable of loading a C# Windows Form file and display it to the user just like (or similar as) we developers see it in the VS Designer.
Once open, the user must be able to click on any of the visual controls and set some properties for the the control. These properties are not the native control properties we set at design-time but specific properties of my application (e.g. user-role allowed to see that control when the form is executed).
Hopefully I explained well enough for you to get the idea.
I'll really appreciate your help.
Thank you
-FJ
|
|
|
|