|
Hi there!
I'm coding a windows application with VS 2005 Express edition.
The application has only a DataGrisView to show the Customers table of Northwind database. (Very simple)
When I try to add the database source for the DataGridView, and add a new connection in the wizard, I select the Northwind database, then I select "Use SQL Server Authentication" and set the "User Name" and "Password".
When I try to "Test Connection", the connection fail with the following message:
Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance.
If I use "Use Windows Authentication" (Integrated connection and authentication) there is no problem.
In the other hand, If I use the "SQL Server Management Studio", I can login with those user name and password in order to see Northwind database.
How can I use SQL Server Authentication in the application?
Thank you in advance.
--
Adrián Córdoba
|
|
|
|
|
Can you create a new ConnectionString and then use the same in your app. instead of using it at design time.
If this still does not work, then post your ConnectionString here. However, please make sure of these three points:
1) You are missing the User Instance=true clause, which tells SQL Express to spin up a separate process for the ASP.NET account, eliminating the need to explicitly grant permission to ASP.NET. Note that you should never grant sysadmin priviledge to the ASP.NET worker process, since that is a very priviledged permission level.
2) You should be using the |DataDirectory| variable in place of the fully-qualified path to the database, for example: |DataDirectory|\<mdf_filename>.MDF
3) MACHINENAME must be local when using SQL Express. Consider using .\SQLExpress for the machine name.
Best Regards,
Sam Xavier
www.componentone.com
|
|
|
|
|
OK, Thank you for your answer.
I tried by modifying the connection string in this way:
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Archivos de programa\Microsoft SQL Server\MSSQL.1\MSSQL\Data\northwnd.mdf";Persist Security Info=True;User ID=northwind;Password=PASSWORD;Connect Timeout=30;User Instance=True"
but I get the same connection error, when I run the application from "Start Debugging" button from Microsoft Visual C# 2005 Express Edition.
May be, Express Edition doesn't allow SQL Server Authentications.
Anyway, I don't know about SQL Server security, but I think when I deploy the application, I should use an "Application Role".
Do you know, where can I read about Application Roles, and how I have to use it?
Thank you, again.
--
Adrián Córdoba
|
|
|
|
|
Have you already modified machine.config file appropriately. If no, then please modify it like this:
All the providers' default configurations point them to use the connection string named "LocalSqlServer" which is defined in the "machine.config" file which lives in the framework config directory. In this file, you shoud modify your connectionstring like the following in the connection strings section:
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" .../>
Best Regards,
Sam Xavier
www.componentone.com
|
|
|
|
|
Hi,
I have a XML file, I want to apply a style sheet to it, and create a new XML file as per style sheet.
Does anyone have any ideas how to do it?
Is it possible?
Thanks!
|
|
|
|
|
zaboboa wrote: Does anyone have any ideas how to do it?
Yes
zaboboa wrote: Is it possible?
Yes
It makes no difference if you are generating HTML or XML or Java code or whatever, it all works the same way, the only thing that is different is the XSLT.
led mike
|
|
|
|
|
Thank you!
I know that the XSL file is different, that is what applies the transformation.
What I was looking for is the actual way of how to do it.
But I found the answer to my own question with XslTransform class.
Regards,
|
|
|
|
|
If anyone else has the same question with regards to XML and XSL, the XslTransform class will do the job.
Regards
|
|
|
|
|
Hi,
Anybody can help me to develop Integrated Voice Responce System using C#.
|
|
|
|
|
|
|
For example, if i VirtualProtectEx portion of memory of another program, with page guard or no access, how can i handle the exception when it will be raised, and get exception informations like registers value ect...?
I think to handle the exception my program would require enabled debug privileges which i know how to code but then i don't know how to set a top level exception filter.
I am still learning so any help would be great.
|
|
|
|
|
Cptkli wrote: For example, if i VirtualProtectEx portion of memory of another program, with page guard or no access, how can i handle the exception when it will be raised, and get exception informations like registers value ect...?
You can't. Your code will never see the exception. This would require a technique called ".DLL Injection", which is something that C# alone cannot do because of the .DLL library requirements of the technique. This is a very advanced technique. Not something for beginners to try and pull off.
|
|
|
|
|
But i did read it's possible to replace the exception handler of a program without injecting any code with the SetUnhandledExceptionFilter api. It replaces the existing top-level exception filter of the targeted program. Is it wrong?
|
|
|
|
|
How can I determine if a text file was written using ANSI, Unicode or any other encoding?
|
|
|
|
|
|
I have a simple C# apllication that is transfering files from one machine to another. PC's are connected via VPN. Copy(path1,path2) function works very slow - about 1% of bandwidth. What can be the reason ?
I'd be very greatful for any help
|
|
|
|
|
Hi,
are you pushing or pulling, i.e. which of the paths is the local one?
I expect performance could be quite different, with pull much faster than push,
although I never tried it.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
What happens when you normally copy files? It is any faster?
|
|
|
|
|
Hello all.
I am trying to decide if it's better to have all my classes in one .cs file within my project(for instance 'MyClasses') and then just put all my classes inside that file. This would result in code like this.
MyClasses.MyClass x = new MyClasses.MyClass():
The alternative is obviously putting each individual class in it's own .cs file under the project. This would enable me to simply do
MyClass x = new MyClass();
What is the advantage/disadvantage of doing this both ways?
I do not want to build the classes in a separate project and import the dll. So I'm really just wondering about these 2 different ways of building the classes in my project.
|
|
|
|
|
IMHO the later is better as it is easy to manage. But don't forget to use namespace[^].;P
*jaans
|
|
|
|
|
Agreed, the latter is better. No need to have a class filled with classes purely for the purposes of grouping. Just make sure they're all under the same namespace.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
you are confusing physical .cs files with namespaces!
It is 100% preferable to stick to the one-class-per-file method.
|
|
|
|
|
I have created two instances of a class in my code but when I assign a value to a property both instances are being updated. I'm sure I must be doing something really obvious wrong, but I can't see what. Please help!
private Campaign objCampaign;<br />
private Campaign origCampaign;<br />
<br />
origCampaign = (Campaign)Session["origCampaign"];<br />
objCampaign = (Campaign) Session["objCampaign"];<br />
<br />
objCampaign.WaveCount = Convert.ToInt32(txtNbrWaves.Text);<br />
<br />
<br />
public class Campaign : IComparable<br />
{<br />
private int _WaveCount;<br />
public int WaveCount<br />
{<br />
get<br />
{<br />
return _WaveCount;<br />
}<br />
set<br />
{<br />
_WaveCount = value;<br />
}<br />
}<br />
}
|
|
|
|
|
I suspect that somewhere along the line objCampaign and origCampaign are being set equal to one another. If they are then the references (tho different) point to the same object in memory. OR something is happening in Session (whatever that is) that breaks your indexer. Why are you indexing on the variable name btw?
Scott P
"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand
|
|
|
|