|
Could use someone to double check my work here, looking for unnecessary info, unneeded commands, broken or missing thoughts...meaning did i start somthing but forgot to finish it. and any security violations or leaks that may exist.
I've gotten so far into this that my flow charts are now circles and i've re-written it twice(flowchart). I'm looking for someone or many someones' who would be willing to check it out....
Please note that my desired result is a software program that does not load on any computer that is not allowed for it to load on.
I am attempting to do this by contacting the database and looking for a keyword....if the keyword is missing then it doesn't install.
the keyword is deleted by the software program upon install (yes i understand that i'll have to re apply the keyword upon every new install, i want that!)
then i want every login from the software to log a transaction, as well identify itself on a user id table upon the intial installation.
info about my code:
fp.Value makes a machine id number that is unique for each pc.
InitializeComponent2 is a form that tells the user they've screwed up and closes the app
Connection is the method that loads my treeView from the database
Yes the typeset small, but i didn't want to take up more space than needed.
it should copy over ok.
thanks!!!
<small> DateTime dt = DateTime.Now;
string usename = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
string sqlSelect = "SELECT password FROM user_id WHERE username = 'dash' ";
private void dbConnect()
{
dataConnection.ConnectionString = "user ID=blah;Pwd=blah;Initial Catalog=blah;Data Source=blah";
dataConnection.Open();
dataCommand.Connection = dataConnection;
}
private void InitialTransAxs()
{
this.Cursor = Cursors.WaitCursor;
Fingerprint fp = new Fingerprint();
string MacID = fp.Value().ToString();
try
{
string shostname;
string result;
result = System.Environment.MachineName;
shostname = Dns.GetHostName().ToString();
dataCommand.CommandText = "insert into user_id (username, password, computer_name, dns_name) values ('" + usename + "', '" + MacID + "', '"+ result +"', '" + shostname + "')";
dataCommand.ExecuteNonQuery();
dataCommand.CommandText = "update user_id set password = null where username = 'dash'";
dataCommand.ExecuteNonQuery();
this.Cursor = Cursors.Default;
}
catch (Exception e)
{
MessageBox.Show("(001) Sorry Could not connect to the database, please try again later." +e.Message + e.StackTrace);
}
finally
{
}
}
private void LogTransAxs()
{
this.Cursor = Cursors.WaitCursor;
Fingerprint fp = new Fingerprint();
string MacID = fp.Value().ToString();
string shostname;
string result;
try
{
result = System.Environment.MachineName;
shostname = Dns.GetHostName().ToString();
dataCommand.CommandText = "insert into TransAxs (username, password, computer_name, dns_name, date) values ('" + usename + "', '" + MacID + "', '"+ result +"', '" + shostname + "','"+ dt +"')";
dataCommand.ExecuteNonQuery();
}
catch (Exception es)
{
MessageBox.Show("(002) Sorry Could not connect to the database, please try again later." +es.Message +es.StackTrace);
}
}
private void LoadAccess()
{
this.Cursor = Cursors.WaitCursor;
Fingerprint fp = new Fingerprint();
dbConnect();
dataCommand.CommandText = sqlSelect;
try
{
bool loginOk = false;
bool IdOK = false;
object o = dataCommand.ExecuteScalar();
string thePwd = o as string;
if( thePwd != null)
{
if( thePwd.Equals("board"))
{
loginOk = true;
}
}
if(loginOk == true)
{
InitialTransAxs();
LogTransAxs();
InitializeComponent();
Connection();
dataConnection.Close();
dataConnection.Dispose();
}
else if (loginOk == false)
{
dataCommand.CommandText = "SELECT password FROM user_id WHERE password = '"+ fp.Value() +"' ";
object p = dataCommand.ExecuteScalar();
if (p != null)
{
if (p.Equals(fp.Value().ToString()))
{
IdOK = true;
}
}
if (IdOK == true)
{
LogTransAxs();
InitializeComponent();
Connection();
}
else
{
InitializeComponent2();
dataConnection.Close();
dataConnection.Dispose();
}
}
else
{
InitializeComponent2();
dataConnection.Close();
dataConnection.Dispose();
}
}
catch (Exception e)
{
MessageBox.Show("(003) Sorry you are not authorized to view this material." +e.Message +e.StackTrace);
}
finally
{
dataConnection.Close();
dataConnection.Dispose();
}
this.Cursor = Cursors.Default;
</small>
Dim Beautiful As String
Beautiful = "ignorant"
Label1.Text = "The world is full of " & Beautiful & " people."
Why is common sense such an un-common comodity?
|
|
|
|
|
Hi
i work in a project about database and use datagrid . i want to prevent user from adding new record ( by clicking the * sign in datagrid ) but i can not find anything like allowAdd or CanAdd for disabling the add ability .
can someone help me ?
Regards Amir Jalaly
|
|
|
|
|
The DataGrid class does not have a property that controls whether a new row can be added. But the DataView class does have such a property (along with some others such as AllowEdit and AllowDelete). Here is code that will turn off the append row by getting at the dataview associated with the datagrid.
string connString = @"Provider=Microsoft.JET.OLEDB.4.0;data source=C:\northwind.mdb";
string sqlString = "SELECT * FROM customers";
// Connection object
OleDbConnection connection = new OleDbConnection(connString);
// Create data adapter object
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(sqlString, connection);
// Create a dataset object and fill with data using data adapter's Fill method
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet, "customers");
// Attach dataset's DefaultView to the datagrid control
dataGrid1.DataSource = dataSet.Tables["customers"];
//no adding of new rows thru dataview...
CurrencyManager cm = (CurrencyManager)this.BindingContext[dataGrid1.DataSource, dataGrid1.DataMember];
((DataView)cm.List).AllowNew = false;
If your datagrid contains links, then adding Navigate handler such as the one below to disallow the AddNew.
private void DataGrid1_Navigate(object sender, System.Windows.Forms.NavigateEventArgs ne)
{
if(ne.Forward)
{
CurrencyManager cm = (CurrencyManager)BindingContext[DataGrid1.DataSource,DataGrid1.DataMember];
DataView dv = (DataView) cm.List;
dv.AllowNew = false;
}
}
Live Life King Size
Alomgir Miah
|
|
|
|
|
In the article “Bending the .NET PropertyGrid to Your Will” , “Fruit enum” is define at design time and therefore the selection for property in to the PropertyGrid allow to select one of them. Is it possible to get the values form database on the fly and and allow user to select one of them.
Best Regards,
Hardew Singh
|
|
|
|
|
I suppose you could, but I don't really know how. I haven't used property grids yet.
I'll suggest you post this question in the article's own message board. You'll probably get better answers (including from the author, who knows a lot about his article (I suppose )).
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
It's been awhile since I've been deep into the property grids but yes you can do what you want to do. For valid values (which is what you talk about) there is a GetProperties() method or something like that that you override. You return the list of valid values in that call which can be from a database. Look at this article to get specifics.
MSDN Article on property grids[^]
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
Yes it is Resize but is happen also if i resize manually the form, but i need to understand if the user has clicked on the maximize button.
How?
|
|
|
|
|
I am not sure if such an event is available but in the SizeChange event you
can check for
if ( this.WindowState == FormWindowState.Maximized )
{
...
}
Live Life King Size
Alomgir Miah
|
|
|
|
|
|
Hi there. I'm running this website www.elefun.net for my company. It is an C# .net solution.
Most of the website/product information and user information is based on an Access db. I've got some negative comments about Access db's like:
1. Access db's are bad and should not be used.
2. Access do not handle large db's well.
So I've been considering to change to an SQL db for I while, but I really don't know if it's nesessary. My Access db is at the moment about 9MB. My questions are:
3. Is it OK to use acces db's for this kind of solutions?
4. Does Access db's get to large. If they do? When are they to large? 10MB, 100MB, 1GB. I really don't have any clue.
5. Is converting from an Access to an SQL db hard? I've worked some with both kinds of db's, but never tried converting between them. Will I have to do many changes in my solution, or will changing the db connection be it?
|
|
|
|
|
Access is a database meant for desktop use. It's not meant to be used in a web environment. Since Access databases don't compact themselves, with continued use, your database will get bigger and bigger over time. You'll have to shut down your website, launch Access, or some other tool, compact and repair the database, then bring your website back up.
Think about it. You're using a website that has the possiblity of growing. An Access database will be a large bottoneck in the performance of your site, should it get the traffic.
It's relatively easy to upsize an Access database to SQL Server. There's a tool built into Access to do it. It's just that what is generated by the tool might not be the best performing SQL. It's a decent short term solution, but you'd probably be better off re-writing for SQL Server by hand.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
1. Access is sometimes convenient, and works well if the demands of the application are not too great.
2. Depends on what you mean by "large".
3. I don't know. I have not used Access in a web application. I know that in a non web server environment that the more simultaneous users you have, and the larger the db, the more corruption problems I have had. I don't know if the same applies in a web app since there will probably only be 1 user (network Service account in win 2k3).
4. I did not have much problem until the database size exceeded at least 500MB or maybe a little larger. I had many corruption problems by the time the db reached 1GB. This was with about 10 to 15 simultaneous users with the mdb file on a network share.
5. It should not be too difficult to convert. I haven't worked with Access in a .Net environment, but in the old days, the date fields required slightly different delimiters than SQL Server.
Note: All my Access experience was with Access 97 using old ADO. I have not used Access in about 3 years.
|
|
|
|
|
4. The hard limit is at 2GB. But be warned: Regulary inserting and deleting in an Access db will result in a growing file. So even if you have 9 Mb of content your file can get a size beyond the 2 Gb limit.
|
|
|
|
|
Thanks for the help by all of you. It seems like I'll continue use the access db for a while. Then I'll have the time do develop a good alternative SQL db for later use.
About the growing size of the Acces db whenit's used. Will this growth be seen as the filesize so I can monitor the size by checking the file by FTP or other?
If my Access db need to be cleaned up. How do I do it? If the growth in size is caused by use, and not data...
|
|
|
|
|
Hi,
Just a quick question. Let's say I have the WebSphere MQ .NET libraries installed on my local machine, and in my C# code I use the directive 'using IBM.WMQ;'. Everything compiles successfully & runs well on my machine. But what happens when I run the app on another machine, one which may not have WebSphere installed? Will the executable error? Is there some way I can customize this error, perhaps by checking if a library is available before 'using' it in my C# code?
Thanks in advance,
Andrew
|
|
|
|
|
Um but to use classes from IBM.WMQ you had to reference some .dll library (or maybe it was referenced by default). It won't work at all if you don't have that .dll on another machine! One possible solution is to look at references in project explorer (VS.NET, dunno how it is on other IDEs) and in properties to that reference set Copy Local (or something like that) to true. Than you'll have copy of necessary .dll in application's \bin folder.
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
The best method is to make sure that the WebSphere is installed before you install your app or is installed with your app.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi guys,
I searched MSDN and google for some help, but I could only find very basic solutions. What I want to do is a little tricky I think, but there are Add-Ins out there which do it, so it has to be possible.
A want to write an Add-In and want to integrate it really into Outlook. So there should be a button on the left site (where the E-Mail, Calendar, Contact, and so on Buttons are). If this button is pressed, there should come up a frame (of course inside Outlook, as if you'd pressed the "E-Mail" button), where the data which is processed by my Add-In is shown.
Another feature should be, that you can add the data source my Add-In should use by adding an "E-Mail Account". So you should be able to add an additional servertype (I'm not shure if it's called that way, cause I only have the german version) and my Add-In should be able to read the information stored that way. By the way, if you choose the "additional servertype" of my Add-In there should of course be a custom frame, because Outlook will not be able to know, what information I need to get from the user.
I hope someone understood my describtion and knows some answers.
I understand, that this is a lot of stuff I'm asking, but if you have some tutorials or samples I would be very happy with that.
Stampede
|
|
|
|
|
|
Does anyone of you know how to create a makefile using c#?
The makefile should be in what format e.g txt?
Where should the makefile be stored? In the same directory as my c# file remoteassembly.cs where I wish to use the makefile to create an assembly
Lastly, how do I use nmake to execute the makefile?
Thanks for your help. I posted this request only because the book that I am using does not show the way and I am also confused with the explantion provided in the documentation.
|
|
|
|
|
This article[^] discusses using C# with nmake and includes a sample makefile. Hopefully it may be of some use to you.
Also take a look at the samples in the Framework SDK
\Program Files\Microsoft.NET\FrameworkSDK\Samples\quickstart
All these have makefiles.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
I am trying to populate a grid based on 7 table join. For this I wrote an SQL Query in front end and then I am filling the tables in a Data Set. Everything works fine. But, I have to display two more columns ( Token# and License#) in the data grid based on the same table column (for ex; Ast_Refnr) which I am able to achieve too. I have a Product ID column in table and based on the Product ID value I need to fill the values in the addition columns.
The additional columns that I am displaying or Token# and License#.
If Product ID is 1, then I need to display a value for the column Token# in data grid and License# must be blank. Also, if the Product ID is 4, then I need to display a value in column License# and Token# must be blank.
Since I am populating the above two columns in data grid based on the same table column AST_Refnr value, neither Token# is empty nor License#. I dont know how to use conditions while popualting the Data Grid. Below I am copying a bit of my code which I use for populating data grid.
sSQL = "SELECT A.PRD_PRODUCTTYPE, C.AST_REFNR+' - '+ convert(varchar,D.SHP_SHIPDATE,101) Token#, " +
"C.AST_REFNR+' - '+ convert(varchar,D.SHP_SHIPDATE,101) License#, B.PRDD_ProductID, " +
"E.ASTP_TEMPLATENAME, F.ASTS_STATUS_DESCRIPTION, C.AST_REFNR, D.SHP_SHIPDATE FROM " +
"PRODUCT A,PRODUCTDETAIL B,ASSET C,SHIPPING D,ASSETPRODUCTS E,ASSETSTATUS F, Contact G WHERE " +
"A.PRD_PRODUCTID = B.PRDD_PRODUCTID AND B.PRDD_PRODUCT_ORDERID=C.AST_PRODUCT_ORDERID AND " +
"C.AST_ASSETID=D.SHP_ASSETID AND C.AST_DEFID=E.ASTP_DEFID AND C.AST_STATUSID=F.ASTS_STATUSID " +
"AND AST_ICA = '" + SearchForm.strPrimary + "' AND G.CNT_ContactID = D.SHP_contactID " +
"AND A.PRD_DELETED=0 AND B.PRDD_DELETED=0 AND C.AST_DELETED=0 AND D.SHP_DELETED=0 AND " +
"E.ASTP_DELETED =0 AND F.ASTS_DELETED=0 AND G.CNT_Deleted = 0 ORDER BY A.PRD_PRODUCTTYPE";
OdbcDataAdapter da = new OdbcDataAdapter(sSQL, con);
da.Fill(ds, "Product");
da.Fill(ds, "AssetProducts");
dataGrid1.DataSource = ds.Tables[0].DefaultView;
DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.RowHeadersVisible = false;
DataGridTextBoxColumn column1 = new DataGridTextBoxColumn();
column1.MappingName = "PRD_PRODUCTTYPE";
column1.HeaderText = "Product";
column1.Width = 70;
tableStyle.GridColumnStyles.Add(column1);
this.dataGrid1.TableStyles.Add(tableStyle);
tableStyle.MappingName = "Product";
--- This value I need to display in data grid if PRD_ProductID is 1
DataGridTextBoxColumn column6 = new DataGridTextBoxColumn();
column6.MappingName = "Token#";
column6.HeaderText = "Token#/ShippedDate";
column6.Width = 150;
tableStyle.GridColumnStyles.Add(column6);
this.dataGrid1.TableStyles.Add(tableStyle);
--- This value I need to display in data grid if PRD_ProductID is 4
DataGridTextBoxColumn column7 = new DataGridTextBoxColumn();
column7.MappingName = "Lic#";
column7.HeaderText = "License#/ShippedDate";
column7.Width = 150;
tableStyle.GridColumnStyles.Add(column7);
this.dataGrid1.TableStyles.Add(tableStyle);
This forum has helped me a great deal and again I am approaching this for help. Thanks everyone in advance.
Looney
|
|
|
|
|
Hope this helps,
Subscribe to DataTable.RowChanged event. In the event handler, check for the
DataRowAction.Add.
Then depending on the values of Product ID , set the values of Token# and License#.
Then call DataTable.AcceptChanges()
Here is some code snippet, please change accordingly
Private myTable As DataTable
Private Sub [AddHandler]()
myTable = CType(datagrid1.DataSource, DataTable)
AddHandler myTable.RowChanged, AddressOf Me.myDataTable_Changed
End Sub
Private Sub myDataTable_Changed _
(ByVal sender As System.Object, ByVal e As System.Data.DataRowChangeEventArgs)
Console.WriteLine("Row Changed", e.Action, _
e.Row.Item(datagrid1.CurrentCell.ColumnNumber))
End Sub
Live Life King Size
Alomgir Miah
|
|
|
|
|
This will be a lame question to those who know classes well, so go easy on me. I understand how to make simple classes, like one that can hold peoples' names and addresses). But I need to make one that can hold an array with an array. Here's my goal: I'd like to populate a class (array?) of server names, but I get confused when I try to have THAT class have an array of its own to hold all the services for each server. I hope that makes sense. Using 2D arrays is the easy method, I know, but I have to grasp classes at some point. Thank you for any help.
-Michael
|
|
|
|
|