|
That was my thought process. The installer itself is not a setup project, but rather a small executable program that wraps the installer with a custom class. It runs the SQL setup in a shell and waits for the process to finish and then launches the setup MSI. That setup has a custom action that collects information and runs a SQL script.
So my idea was to embed a form in the installer wrapper application to prompt for username information for the SQL account, but the average user would be dumbfounded. I guess the bigger issue here is whether anyone has gotten an unattended SQL install to work, and if so using what user for the SQL service account?
|
|
|
|
|
I am trying to figure out how to get a path string to the public directory in Windows 7. On my system the path is C:\Users\Public. Since someone may move this directory to another location, I would like to be able to locate it through code instead of hard coding a path string.
I have looked into using "Environment.GetFolderPath(Environment.SpecialFolder.#####)" but I can't find a SpecialFolder enumeration for the public directory. Does anyone have any suggestions?
Thanks for considering my question,
CraigCraig
|
|
|
|
|
I don't know about .NET 4.0, but there is no enum value that returns the path to the Public folder in any version of .NET up to and including 3.5.
You'll have to resolve the Public environment variable to get that path.
string PublicFolderPath = Environment.GetEnvironmentVariable(@"Public");
|
|
|
|
|
Dave,
Thanks for taking the time to help me. It confirms what I suspected about using that enumeration. Your suggestion will work fine.
CraigCraig
|
|
|
|
|
Hi.
I have program with SQLSERVER 2000.My Server Name is saved in text file in 'C:\Server.txt';and when program is started , program will read Server Name from text file.
But when i start my program from (Remote computer in my network) it's not working.And an exception is shown
"The Timeout period elapsed prior to completion of the operation or the server is not responding";
Is the problem in my network?
or in program?
And this is my Connection String:
"Data Source=" + Program.serverName + ";Initial Catalog=Nicco;Integrated Security=True";
Thank you.
CanI
|
|
|
|
|
Is the server name correct? Have you tried using TCP/IP address instead of server name?
|
|
|
|
|
Hi.
Server Name is Correct.And my network is working well because when i write in 'Run' for example '\\Server' it respond and i can copy any file from client to server and also from Server to client.
CanI
|
|
|
|
|
But if you have a different network (different than TCP/IP) the \\Server will work, but the TCP/IP will not.
Try using ping to see if it is working.
|
|
|
|
|
Ok, let me start off by saying that this is my first post ever, so be gentle.
I am having an issue with a web service where I am randomly getting the following error:
System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.
The error stems from the same object all of the time. So after investigating the issue I believe it is happening because I am using a static TableAdapter for one particular sql server database table. This is a surrogates table which is used to track keys to all of the other tables within the database (Not my design and I cannot change it).
Here is my question:
Would it be better to implement the static TableAdapter and lock that or to create a generic object to lock and create a new TableAdapter every time I would like a new key. This Surrogate table has roughly 30 different tables that it manages keys for and it probably will create between 100 and 200 keys per call. So creating a TableAdapter every time that method is called seems like wasted resources but I am not sure if having a static TableAdapter is the best way to go either. Also, any better way to handle it would be greatly appreciated.
Example Code:
This Way
public class SurrogateClass
{
public SurrogateClass(){}
private static SurrogateTableAdapter SurrogateAdapter = new SurrogateTableAdapter();
public static int GetSurrogateByTableName(String tableName)
{
int result = 0;
lock (SurrogateAdapter)
{
SurrogateRow row = SurrogateAdapter.GetSurrogateByTableName(tableName).FindByTABLENAME(tableName);
if (row != null)
{
int.TryParse(row.SURROGATE.ToString(), out result);
result += 1;
row.SURROGATE = result;
SurrogateAdapter.Update(row);
}
else
{
result = -1;
}
}
return result;
}
}
Or this way
public class SurrogateClass
{
public SurrogateClass(){}
private static object lockerOjbect = new object;
public static int GetSurrogateByTableName(String tableName)
{
int result = 0;
lock (lockerObject)
{
using (SurrogateTableAdapter SurrogateAdapter = new SurrogateTableAdapter())
{
SurrogateRow row = SurrogateAdapter.GetSurrogateByTableName(tableName).FindByTABLENAME(tableName);
if (row != null)
{
int.TryParse(row.SURROGATE.ToString(), out result);
result += 1;
row.SURROGATE = result;
SurrogateAdapter.Update(row);
}
else
{
result = -1;
}
}
}
return result;
}
}
|
|
|
|
|
Uuuuh... dunno.
I use DataReaders all the time (and never TableAdapters). I also haven't done much with Web Services. And I use GUIDs as keys. So quite likely I would never run up against what you have.
You might try locking the Connection instead of the TableAdapter; just a shot in the dark.
P.S. Oh, and this may be a case where you need two Connections.
|
|
|
|
|
Thanks for your reply but I really cannot change the keys to use GUIDs and even if I could, I probably would not use them because I do not believe them to be better for our particular scenario. There are certain times where using GUIDs are advantageous but since I do not need to merge records, create keys outside the db or application, and I am not using replication or an ORM, I really do not need deal with the extra data not to mention that integer keys are faster. As far as locking the connection or needing two connections I do not believe either are necessary. Both of my code posts solve my problem there is just a difference in how many objects are created and when they are destroyed and I was wondering if there is either a better way of fixing my problem or someones opinion on which one is better and why.
Thanks for the help.
|
|
|
|
|
hi
i have 3 panels and 2 buttons.
in panel1 i have a few controls along with 2 buttons.
when i click on button2(which is inside the panel1)
only i need to show the panel2, if i click the same button2 i need to imvisible the panel2..(Here i am providing two up and down images to hide and show the panels).
by default in form_load i need only panel1 and panel3
|
|
|
|
|
|
Hi everyone,
I currently have a gridview on my .aspx webpage and i want my page to reload by itself every 5 minutes. I have added a Timer Control in order to do this. However, does anyone have any idea what is the coding that i should write in my Timer_Tick method? I need to do this in c# language.
thank you.modified on Friday, February 19, 2010 11:35 AM
|
|
|
|
|
I would say you are better off implementnig this in JavaScript or use the refresh meta tag I know the language. I've read a book. - _Madmatt
|
|
|
|
|
How do i implement the refresh meta tag?
|
|
|
|
|
Like this[^]."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
however, instead of reloading the whole page, my goal is to just refresh the grid at a particular interval. i implemented an UpdatePanel with timer. however, i am unsure of the c# code to implement inside my Timer_Tick method.
protected void Timer1_Tick(object sender, EventArgs e)
{
}
|
|
|
|
|
Hi everyone,
Does anyone know how i can retrieve the IP address of the host PC, and then compare that IP Address with a list of IP Address which is stored in a MS Access database to verify that the host PC is able to view the webpage. I need to do this in C# language.
thank you.
|
|
|
|
|
That may not work very well when the client uses DHCP.
|
|
|
|
|
currently, i am already able to retrieve the ip address of the host PC. right now, i just need to compare it with a list of IP Addresses in my database to search for a matching IP Address. then, if that IP Address is valid, i would allow the user to view the webpage. I am unsure of how this could be done? does anyone have any idea to guide me through?
thank you!
|
|
|
|
|
But the IP address of a system a valid user is using may change. Tracking IP addresses is generally not a very reliable technique and not worth the trouble.
|
|
|
|
|
hello!
i must tell you from the beginning that i am a C# newbie so please bare with me...
i just started learning C# a month or so ago so i am just at the beginning of (what seems to be) a very interesting journey.
my current project demands that i kill any process specified by the user.
i already finished the first part of the program:
the user inputs the name of the program,actually the process, and then clicks the "terminate" button.
the program takes the name and kills the process with the same given name. it shows the "success" message in a text box if anything is OK or shows a message box if some specified errors occur.
now all that works for any ordinary process, the process gets killed, no questions asked!
but
what about protected processes???
i tried to kill my AV process (i use AVAST free, up-to-date version) and it catches a "protected process" error...
the fact is that this error may occur in different cases,even spywares use certain methods to ensure that killing their program is impossible...
now,my obvious question is: how to bypass the process protection and kill those pesky,protected processes??
i have two guesses:
1) there may be some sort of special privileged mode to call the kill function in C# like some special administrator or something
or
2) (here i need serious help as i am a total noob at this part: ) there may be a way to add some info to some windows registry files (if that's what they're called) so that every time windows boots up and starts loading programs,my prog will start up first and block the others from booting up or even deletes the process' sources. Of course,this has to be done entirely by my C# code and i know that a noob like me messing up with window's components' codes may really F**K up the OS for good ...
that's why i really need help...
thanx a lot in advance!
ps: i now see that what i am referring to is a SYSTEM -driven process.
so yes, can you tell me how to kill a SYSTEM process using C#??
modified on Friday, February 19, 2010 10:52 AM
|
|
|
|
|
andyxfun wrote: but
what about protected processes???
Simple. You cannot kill them. System processes cannot be killed by normal or even admin users.
andyxfun wrote: ,even spywares use certain methods to ensure that killing their program is impossible...
A user that picks up a spyware, in most cases probably (in all cases that I know about) also cannot CREATE a process that cannot be killed.
|
|
|
|
|
I need a new class that will build string and each element will link to the next node. I believe this is done using a linklist, but I am having trouble and need some guidance. So far I have
Class ListNode
{
string x;
ListNode Next;
}
Class List
{
ListNode First;
}
Any help would be excellent
|
|
|
|