|
you need admin rights to register a dll. Welcome to the hell that is vista.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
thanks a lot for yr reply but how can i get admin rights to register those dll's programatically ..
|
|
|
|
|
The user needs to choose to run the app as admin, or I believe you can set up the manifest file to specify that such rights are required.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hi all!
I have gotta small dilemma in proceeding with my project. I thought it would be better to ask the gurus to sort it out in their own fashion...
Here it goes...
I am developing a small consoleapplication, which is used to fetch data from a distance server.
The details of "which" data to be fetched is given as a command line option. I have several such commands and everything was working fine. But now, for some reasons i want to restrict the usage of certain commands, i.e., much similar like a basic user and admin user level. Admin user can use all the command options whereas basic user can use only non-restricted commands.
For this, I have created two attributes named "admin" and "basic" and applied to the corresponding commands. The attributes need to compared with the user level configuration.
Now how do i make the application to differentiate the user rights??
option 1: Have a XML config file with a "user level" field and read the XML file in the runtime and allow access...
option 2: have a shared dll file with a "user level" property and read the dll during runtime and allow access accordingly....
Note: The main requirement is that user rights can be upgraded and downgraded from "basic" to "admin" and vice versa just by modifying the configuration entries...
Please suggest, which one to use and if any other better option too....
Have a Happy Coding.....
|
|
|
|
|
The trouble with XML is that it's human readable and easy to change, if someone wants to give themselves admin rights.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
yes obviously....
That is the reason why i keep on scratching my head.......
Have a Happy Coding.....
|
|
|
|
|
You could use a mechanism where you sign the xml with a certificate (private key). Within your dll you can check the signature of the xml (public key), to check that the xml was modified by you. This will let you take the advantages of xml when a user upgrades (better than using a dll that you have to compile).
Regards
Sebastian
|
|
|
|
|
Thank you sebastian!
Oh!! That really thrown some light!!!
Thanks again...
Have a Happy Coding.....
|
|
|
|
|
what is the use of get set properties in C #
|
|
|
|
|
Properties are a better way of controlling your private member variables.
get and set accessors are used to facilitate this access control.
assume you have a private member
private int count;
Now you want to assign some value to the variable and need to read it whenever required.
You can safely reveal your count variable to external world using a property declaration like this:
public int Counter
{
get
{
return count;
}
set
{
count = value;
}
}
"There are a few reasons to use properties, instead of public fields. One is that properties can be virtual. Another is that you can make the setters for a property private. Another is that properties have a 'special' meaning to things that inspect classes at runtime. There are frameworks for conveniently talking to databases and for reading and writing objects to and from XML and all sorts of other things -- and they automatically look at the object's properties (and not private fields or other things) to see how to do their job."
For better clarification i would suggest you to buy a C# book and spend some time in learning the basics..... rather than asking the same in the forums.....
Have a Happy Coding.....
|
|
|
|
|
To add to this most excellent reply, they also aid with encapsulation. Because you expose a method rather than a field with get, set, the implementing class can replace the internal implementation of the property without affecting the outside world. If your class keeps a hard count of elements in a tree (say) and exposes that via "public int count" then it must retain that count for all time. If it is exposed via
public int Count
{
get { return count; }
set {count = value; }
}
then it is at liberty to dispose of the "count" field and replace it with a new implementation at will. This will not affect classes relying on the "Count".
Further, it allow you to error check the assignments:
public int Count
{
get { return count; }
set
{
if ((value < 100) && (count >= 0))
{
count = value;
}
else
{
throw new Exception(string.Format("Value out of range: {0}", value));
}
}
}
But I agree - read a book, because if you don't know this stuff, there are a lot of other complexities you need to be aware of before you go much further!
Good luck.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
|
HOw i Display CSV File Data TO DataGridView
Please Help me With Connection string And Code.
|
|
|
|
|
Hi!!!
Try to do some research by yourself instead of asking code from others....
have a look at this site....
csv to datatable[^]
Can give you some insight regarding the issue....
Have a Happy Coding.....
|
|
|
|
|
I have tried it But i got Error Path is not correct even i give it to right path
here is my code
string Con_Str = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My\a.csv;Extended Properties=Text;HDR=No;FMT=Delimited";
OleDbConnection cn = new OleDbConnection(Con_Str);
cmd=new OleDbCommand("select * from Book1.CSV",cn );
da=new OleDbDataAdapter(cmd);
ds=new DataSet();
da.Fill(ds,"ex");
dataGridView1.DataSource=ds.Tables[0].DefaultView;
|
|
|
|
|
So what's the filename of your CSV file?? In your code you have, in the connection string, C:\My\a.csv. But, in the OleDbCommand, you have Book1.CSV. So, which is it??
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.Runtime.InteropServices;
using Excel = Microsoft.Office.Interop.Excel;
using System.Data.OleDb;
using System.Security.Cryptography;
public DataSet ExcelToDS(string Path)
{
//return one dataset
object missing = Missing.Value;
Excel.Application excelApp = new Excel.Application();
excelApp.Visible = false;
try
{
excelApp.Workbooks.Open(path, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);
excelApp.Workbooks[1].Worksheets[i + 1];
Excel.Worksheet ws = (Excel.Worksheet)excelApp.Workbooks[1].Worksheets[1];
string sheetName = ws.Name;
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Path + ";" + "Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
string strExcel = "";
OleDbDataAdapter myCommand = null;
DataSet ds = null;
strExcel = "select * from [" + sheetName + "$]";
myCommand = new OleDbDataAdapter(strExcel, strConn);
ds = new DataSet();
myCommand.Fill(ds);
conn.Close();
excelApp.Workbooks.Close();
excelApp.Quit();
excelApp = null;
return ds;
}
catch
{
MessageBox.Show("Not close EXCEL", "Err Info", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
KillProcess("EXCEL");
return null;
}
}
modified on Tuesday, May 5, 2009 3:52 AM
|
|
|
|
|
Hi ,
I am developing an application with a datagrid using which user can update the data in the datagrid row. Its all in ASP.Net c#.
on click of a button i should do the following.
Check if user has modified atleast one row.
1. If the user has not modified even one row, then i should display a messsage stating user to action atleast one row.--- I have done this check and works good.
2. If the user has changed atleast one row then i should display a alert asking for confirmation if they would like to proceed. If the user selects 'No' i should stop the execution. if he clicks Yes the execution should proceed. -- I need help on this .. I am not able to trigger it becuase the button is already clicked.
Please help me sort the point 2.
|
|
|
|
|
WE have an ASP.NET forum
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
if the useer click no whit action must be stopped?
modified on Tuesday, May 5, 2009 3:29 AM
|
|
|
|
|
On the click of yes the changes done by the user in datagrid is updated in databases. This should not happen if he clicks no.
|
|
|
|
|
if(MessegeBOx.Show("Are you sure?",...,MessageBoxBottunYesNo) == DialogResult.YES)
update();
else
return;
modified on Tuesday, May 5, 2009 3:28 AM
|
|
|
|
|
You'll using right to limit the buttom, and user right from userlevel list table.
|
|
|
|
|
Hi.
I have a question. Say you have a database with 10 tables, they all are related to each other. Now you start your Windows application and obviously you implement a typed dataset to enable offline work etc.
My question is this, is it better to create a few datasets or just one? Can I create a dataset for each table in the database?
Illegal Operation
|
|
|
|
|
Illegal Operation wrote: Can I create a dataset for each table in the database?
A DataSet can contain many tables, so creating separate dataset for each tables is not required.
|
|
|
|