is accessing the web.config.
Furthermore, if you have two configuration files, only the file of the project you build as Startup project is read by either ConfigurationManager.AppSettings or WebConfigurationManager.AppSettings.
Clean-up crew needed, grammar spill... - Nagy Vilmos
I have a stored procedure that returns two result sets. How can we handle this in EF and calling this in C#? I know that this will be handled easily starting from .Net Framework 4.5. But I am using .Net Framework and EF version 4.0. Please provide any suggestions.
Hello fellow C# developers.
I am doing a little bit login system.I came to a point where I need to log my operations for every user. I made custom Log static class, because I don't need not used objects.
I have the following method in the class.
When I use it for the first time is OK upon button click events, but when I call it again, I get an Exception. I checked it and it was "Cannot write to a closed TextWriter". So what seems to be the problem?
Isn't using opening and closing the writer, so when I open it again it would be ok?
I face issues in connecting to SQL Database on Server machine using C#, but am successful in creating connecting with local database in the system.
1. I enabled remote access (by making TCP protocol Enabled)
I have a server machine with SQL 2008 R2 Express Edition installed, and i have created a Database in that machine.
I cannot start "SQL Server Agent" - getting Remote Procedure Call Failed Error.
But other 2 are in running state (SQL Server (SQLEXPRESS) & SQL Server Browser)
Is that i cannot connect to this server Database using the SQL 2008 R2 Express edition ????
Do i need to have SQL Server 2008 R2 installed ??
You don't need to have SQL server installed on anything other than the server - that's the whole idea of having a server running SQL server: the other machines connect to the SQL server instance and access the DB via that.
Start by connecting to the server instance.
Try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file to use from your C# code.
Until you have that working, you aren't going to get anywhere!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
hi, I am working in C#.net and taking ms-access as backend for windows application. I want to auto generate one number in a particular pattern(eg. AB/2014/2/2).
Here AB: will be some fixed string
2014: present year
5:auto generate no.(will increment after submission of form)
whenever some one will fill the form and will click on submit button then this no. has to be generated. last digit in this no. is sequence no. which will be incremented after checking previous no.
this no. will act as a primary key in database.
can somebody help me out with this? I am not getting how to code this.....
You can configure the DB to automatically set the primary key on insert of a new record.
For the rest, set a date field where you store the date of submission.
On display, you can display the date and the primary key together, e.g. 2014/2/1231
Clean-up crew needed, grammar spill... - Nagy Vilmos
user will fill the form and after clicking on submit button all the details will be stored in the database along with id number(this auto generated number) that will be generated automatically in the format AB/2014/2/6.
AB is fixed
2014 is present year
2 is present month
6 is a no. that will be incremented after checking previous sequence no.
this generated no. will act a primary key in whole database.
There will be no textbox for this no.
It shouldn't; it breaks the first normal form, as it is a compound field that contains multiple pieces of information. A Primary Key should identify the record uniquely, and should NEVER contain a constant.
One of the most important rules in database-design; the primary key does NEVER contain other information than to identify the field. The end-user NEVER sees the PK. Explaining why is simple; your number might change in the real world, and you'd be updating all references to that PK.
Put your fake-number (it's not a number as it contains characters) somewhere as a normal field, and make it a calculated field.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
this no. is uniquely defining fields in database.
Bcoz only string value is constant and rest of the field in the generated no. will be automatically from the present year and month and most imp.
last field in that no. is sequence no. which will get increment after checking previous no.
this means.. 3 fields in that auto generated no. will be combined and will make unique primary key.
Last Visit: 31-Dec-99 19:00 Last Update: 1-Feb-23 22:24