|
teknolog123 wrote: or is there a rule
We try to forget about those, and have decided to go with whatever works
I agree that a database would be the suitable place to store data on a network. If you don't have a server, I'd choose XML; gives you the advantage that you don't need to install SQL just for storing the application-settings, and you can edit it with any editor.
There's also INI-files, and yes, the registry is an option too, albeit one might need admin-rights to modify some keys. A nice option would be to store the settings online, so that they'll persist even after a reinstall.
I are Troll
|
|
|
|
|
I'd say that you should be storing this in the database (SQL Server). That way you can control configuration from a central location and the usuage data from the individual machines is also stored centrally. Remember you have to think of the performance of the administration side as well as the individual user side. The overhead of using a SQL server is minimal.
You also mention storing the information in the registry - How were you going to retrieve this information? While it might be a good location for some of the configuration information I don't think it is a good location for storing commerce information (price, usage times etc.)
|
|
|
|
|
|
You can use Application Settings (Project|Properties.)
Dr. Sandy
It's never too late to become the person you were meant to be.
|
|
|
|
|
Avoid the registry at all costs.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
hi guys...i have a problem as usual...actually an error that i have never seen before..i have two radio button in my form i use one of them to add customer and the second one to add company...while adding company no problem..i can make adding process..but while adding customer i have got an error on the screen by messagebox error says that :
"No mapping exists from object type System.Data.DataRowView to a known managed provider native type."
i have these codes to add the customer
cmd = new SqlCommand("insert into XXX(ad_syd,firma,sektor,grup,cep_no,is_no,ev_no) values (@ad_syd,@firma,@sektor,@grup,@cep_no,@is_no,@ev_no)", con);
cmd.Parameters.AddWithValue("@ad_syd",info.ToTitleCase(txtAdSyd.Text));
cmd.Parameters.AddWithValue("@firma", cmbFirma.SelectedItem);
cmd.Parameters.AddWithValue("@sektor", txtsektor.Text);
cmd.Parameters.AddWithValue("@grup", txtGrup.Text);
cmd.Parameters.AddWithValue("@cep_no", Birlestir(txtCepKod.Text, txtCep.Text));
cmd.Parameters.AddWithValue("@is_no", Birlestir(txtKod.Text, txtisTlf.Text));
cmd.Parameters.AddWithValue("@ev_no", Birlestir(txtEvKod.Text, txtEvTlf.Text));
if ((txtisTlf.Text != ""))
{
if ((txtAdSyd.Text != ""))
{
if (cmd.ExecuteNonQuery() == 1)
MessageBox.Show("Ekleme İşlemi Tamamlandı", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else
MessageBox.Show("Ekleme Sırasında Hata Oluştu", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
MessageBox.Show("* İşaretli Alanlar Boş Bırakılamaz", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
MessageBox.Show("* İşaretli Alanlar Boş Bırakılamaz", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
i replaced a breakpoint but it doesnt enter if (cmd.ExecuteNonQuery() == 1) that line...it goes to catch block directly
what can be the problem ??
|
|
|
|
|
I can't see your code well as it misses formatting (read my sig!).
If you catch an exception, look at its ToString() information and you should be able to pinpoint the problem yourself.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
would need a little more info... put a breakpoint in the beginning and then see where it throws the exception ie. move to catch block.
as you say that it doesn't enter (cmd.ExecuteNonQuery() == 1) there could be a problem with your stored procedure or method Birlestir.
|
|
|
|
|
erdinc27 wrote: if ((txtisTlf.Text != ""))
{
if ((txtAdSyd.Text != ""))
{
At first glance, these if conditions appear to be the culprits (for your breakpoint not getting hit).
Now...bring me that horizon. And really bad eggs...Drink up me hearties, YO HO!
|
|
|
|
|
|
It seems like your code needs some cleanup.
Kolay gelsin. Türkiye'densiniz sanırım.
|
|
|
|
|
hi guys thanks for replies....i think it gives that error because of the codes below
public void DosyaOku(object sender, EventArgs e)
{
StreamReader read = new StreamReader("Firmalar.txt");
string kelime = read.ReadLine();
while (kelime != null)
{
cmbFirma.Items.Add(kelime);
kelime = read.ReadLine();
}
read.Close();
}
because if i didnt work it the program doesnt give error..so what can i do now ??
bu arada simple data evet Türkiyede yaşıyorum ...bu arada kodda bi fazlalık mı var ??
|
|
|
|
|
Fazlalık yok ancak biraz toplarlamak lazım gibi.
---
If you don't understand this post, don't worry. It is his native language.
|
|
|
|
|
hey guys
i think i have found where is my error ...but i dont know how can i solve it...
cmd = new SqlCommand("insert into Rehber (ad_syd,firma,sektor,grup,cep_no,is_no,ev_no,fax,mail,web,msn,skype,dgm_tarih,adres,ilce,sehir,vergi_no,vrgi_daire) values (@ad_syd,@firma,@sektor,@grup,@cep_no,@is_no,@ev_no,@fax,@mail,@web,@msn,@skype,@dgm_tarih,@adres,@ilce,@sehir,@vergi_no,@vrgi_daire)", con);
in that insert statement if i delete the @firma and firma also it doesnt give error...Firma in my form is a combobox that i fill it from my database and i need it in my program so how can i solve the problem
|
|
|
|
|
hii again
thanks guys for your help
i solved my question
bu arada simple data arkadaşım kodları toparlamaktan kastın neydi sölersen sevinirim ben daha yeni sayılırım programcılık işinde
|
|
|
|
|
I have a windows app that uses SQL Server Compact Edition. It's fine on any machine that has VS on it but when I install it onto other machines, I get an error about the DLL's.
Because I don't want to rely on an internet connection during the installation I am including all the set up files etc for SqlCe, which it does nicely, but the DLL files stay in the SqlCe folder in Program Files, and cannot be found.
If I move these DLL's into c:\windows\system32 everything is fine.
Have I missed something in the publishing of my app in VS2008?
(I'm sorry if this is a daft question. I'm pretty new to this)
Thanks,
Huh? oh yeah... I knew that.. :oS
|
|
|
|
|
does the other computer have .net framework? if you are using VS 2008, you may need .net framework 3.5
This is assuming that there are no third party references used. In which case, you need to add those dlls in the installation directory.
One of the obvious methods to check this problem would be to create a basic windows application and running the exe on another computer.
|
|
|
|
|
Hi
The .NET Framework 3.5 is included in the installation, which installs ok before it goes on to install my app.
You are right in asuming that there are no third party refs. It is simply my little 2mb app supposedly shipping with .net 3.5 and the SqlCe dll's.
Should my installation process or app move these files to the system32 folder?
It's a little odd. I'm sure it is something simple.
Huh? oh yeah... I knew that.. :oS
|
|
|
|
|
Unsy wrote: The .NET Framework 3.5 is included in the installation, which installs ok before it goes on to install my app.
I asked you to do a little test by running a very basic application on the target computer. Create a basic windows application, copy the exe file. and run it on the target computer. If it runs, all necessary dlls are in place.
Thats step 1.
Next. if any 3rd party dlls are being used ( may be SqlCe), they need to be copied to the installation directory next to your application.
try these and let me know.
Unsy wrote: It's a little odd. I'm sure it is something simple.
this is why these are called bugs. too simple to detect.
|
|
|
|
|
and yes. please copy the error also.
|
|
|
|
|
Som Shekhar wrote: if any 3rd party dlls are being used ( may be SqlCe)
I'm pretty sure SQL Server CE is part of the .Net Framework, so it should not require an additional installer.
|
|
|
|
|
Hi..
I have encountered a error while calling a method of a Win32 Dll in C# application(both windows and web),
Error : 'Failed to initialize Security' (at CoInitializeSecurity method of Win32 dll - C code)
Error Code: 183 (returned by Marshal.GetLastWin32Error())
This Win32 dll communicates with disk drive using WMI classes. Also doing read/Write and partition on the disk.
We are using .Net Framework 2.0, Windows XP SP2.
Any suggestions or advice most welcomed
Thanks in advance
SunAgen
|
|
|
|
|
183: Cannot create file when that file already exists.
I have no idea what your .DLL does, but there are things code cannot do because it needs admin priv's or is running in a restricted sandbox, like inside Internet Explorer.
|
|
|
|
|
Dear Dave Kreskowiak,
Thanks for reply..
As I stated in the post, that Dll doing disk operations like Disk Partitioning,Reading data from sectors,Writing and Deleting. Fortunately all other operations, except Partitioning working well (in both Windows Application and Web application). Privileges of Administrator given by Impersonation.
But that Partitioning working well in a Windows Application developed in C. problem with only dotnet application(C#).
Thanks..
|
|
|
|
|
To Auto shutdown by c# I call function:
public void ShutDownComputer()
{
ManagementBaseObject outParameters = null;
ManagementClass sysOS = new ManagementClass("Win32_OperatingSystem");
sysOS.Get();
// enables required security privilege.
sysOS.Scope.Options.EnablePrivileges = true;
// get our in parameters
ManagementBaseObject inParameters = sysOS.GetMethodParameters("Win32Shutdown");
// pass the flag of 0 = System Shutdown
inParameters["Flags"] = "1";
inParameters["Reserved"] = "0";
foreach (ManagementObject manObj in sysOS.GetInstances())
{
outParameters = manObj.InvokeMethod("Win32Shutdown", inParameters, null);
}
}
Or call function DoExitWin(1) below:
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct TokPriv1Luid
{
public int Count;
public long Luid;
public int Attr;
}
[DllImport("kernel32.dll", ExactSpelling = true)]
internal static extern IntPtr GetCurrentProcess();
[DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
internal static extern bool OpenProcessToken(IntPtr h, int acc, ref IntPtr
phtok);
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool LookupPrivilegeValue(string host, string name,
ref long pluid);
[DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
internal static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall,
ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen);
[DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
internal static extern bool ExitWindowsEx(int flg, int rea);
internal const int SE_PRIVILEGE_ENABLED = 0x00000002;
internal const int TOKEN_QUERY = 0x00000008;
internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;
internal const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege";
internal const int EWX_LOGOFF = 0x00000000;
internal const int EWX_SHUTDOWN = 0x00000001;
internal const int EWX_REBOOT = 0x00000002;
internal const int EWX_FORCE = 0x00000004;
internal const int EWX_POWEROFF = 0x00000008;
internal const int EWX_FORCEIFHUNG = 0x00000010;
private void DoExitWin(int flg)
{
bool ok;
TokPriv1Luid tp;
IntPtr hproc = GetCurrentProcess();
IntPtr htok = IntPtr.Zero;
ok = OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref
htok);
tp.Count = 1;
tp.Luid = 0;
tp.Attr = SE_PRIVILEGE_ENABLED;
ok = LookupPrivilegeValue(null, SE_SHUTDOWN_NAME, ref tp.Luid);
ok = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero,
IntPtr.Zero);
ok = ExitWindowsEx(flg, 0);
}
Function can perform when application run in desktop, but when pc locked then it can't perform. Why can't? Who can help me? please. Or a way automatic log in from pc locked by c#.
Thanks any help!
|
|
|
|
|
Use InitiateSystemShutdownEx instead of ExitWindowsEx with bForceAppsClosed = TRUE .
But please also be aware of the possible data loss and not to harm users with.
You also should be prepared that in Vista and above the user/system has more
possibilities to avoid/stop shutdown.
Greetings
Covean
|
|
|
|
|