DdoubleD 315 Posting Shark
DateTime datetime = DateTime.ParseExact("10/10/2009 12:00:00", "MM/dd/yyyy hh:mm:ss", System.Globalization.CultureInfo.CurrentCulture);

Also, have a look at this: http://msdn.microsoft.com/en-us/library/system.datetimeoffset.tryparseexact.aspx

DdoubleD 315 Posting Shark

Well, you still left out the directories for the project (properties), but maybe I don't need it anyway. Here is how you would retrieve the record count from the Combo table where Naam='Hamer'... That is to say that I tested by passing in "Hamer" to the method.

public static int GetRecCount(string naam)
            {
                string database = @"c:\AccessDbs\Calaesto.mdb";
                string connParams = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}";
                string connStr = string.Format(connParams, database);

                OleDbConnection conn = new OleDbConnection(connStr);
                string SQLString = "SELECT Count(*) FROM Combo WHERE Naam = '" + naam + "'";

                try
                {
                    conn.Open();

                    using (OleDbCommand cmd = new OleDbCommand(SQLString, conn))
                    {
                        int rows = (int)cmd.ExecuteScalar();
                        return rows;

                    }
                }
                catch (OleDbException ex)
                {
                    Console.WriteLine("Exception: {0}\r\n   Stack Trace: {1}", ex.Message, ex.StackTrace);
                    System.Diagnostics.Debugger.Break();
                }
                finally
                {
                    conn.Close();
                }
                return -1;
            }
DdoubleD 315 Posting Shark

Lol, oops
Here's the update

That was quick! Hey, I just looked at the DB, and I noticed there are only two columns in the Combo table: ComboId and Naam... Is that how it is supposed to be?

DdoubleD 315 Posting Shark

Here are the Project file and the database.

Yep, just the project file (".csproj") and the mdb ;)... Cannot really use the project file by itself; you need to include the source files (*.cs, etc.) too. Sorry about the miscommunication... when we say zip up the project, we mean the "whole" project. I will wait for your updated attachment.

DdoubleD 315 Posting Shark

Take a look at this MS link and look at the example code where instead of filtering numeric digits, they filter everything else... Just modify that code to only accept the characters you want. Cheers!

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keypress.aspx

Geekitygeek commented: always there first with great info :p +1
DdoubleD 315 Posting Shark

I hesitated replying to this because I haven't actually used the FileSystemWatcher, though I am somewhat familiar with it. I'm a little confused what you are asking. Are you saying that when you change the file that FileSystemWatcher doesn't see the change, or are you wanting it to throw an exception if anybody other than the first instance having the file open attempts to access it in shared mode?

DdoubleD 315 Posting Shark

Not a problem. Did you finally get your connection working?

DdoubleD 315 Posting Shark

No worries... Looking at that example, it looks ok to me on the surface except for the line: da.SelectCommand cmd = new SqlCommand("GetAllAuthors", sqlConn); , which I don't think will compile with the "cmd" segment...

DdoubleD 315 Posting Shark

Here's an idea, let's focus on the btnAdd for now...

When you are populating your array, you are always overwriting the first person with arrayString[0,n] because coord zero is always the first person.

I'm pretty sure you want to use your Counter as the index in the above, but you shouldn't be incrementing before and after the if statement: if (Counter <= 20) , which also has a problem if you use it as the index because if it equals 20, you will blow (out of range) the allocated string array's size...

Fix those and come back--okay?..

Suggestion: google "arrays c# tutorial" and browse some tutorials and examples. Sometimes the textbook doesn't always "sink in" and additional references is all it takes for that to happen. Not to brag at all, but I could easily fix the areas above, but that wouldn't benefit either one of us. Use the web as your main resource, then when you get stuck with something particular, let us know because we do want to help.

DdoubleD 315 Posting Shark

and since all my friends and family will be consulting me on the upgrade I figured why not just throw the workaround into a one click solution.

LOL, good idea.

DdoubleD 315 Posting Shark

Here is a crude example of what you wanted, but with only a few of the methods and with the code guts removed. After responding to your new thread, I decided to put together the sample you were looking for. If this answers you original question in this thread, go ahead and mark as solved and we can continue to work out any details in the other thread. I went ahead and used a DataTable object for the table's records to further elaborate on what I was telling you in the other thread too...

class DataAccessLayer
            {
                public static DataTable GetAuthorTable()
                {
                    // dao/db code here to get the records
                    // ...
                    DataTable authorTable = new DataTable();
                    // Fill above with records from dao/db code...

                    // return the records of the Author table
                    return authorTable;
                }
                public static void UpdateAuthor(DataRow authorRecord)
                {
                    // dao/db code here to update the records
                }
                public static void InsertAuthor(DataRow authorRecords)
                {
                    // dao/db code here to insert the record
                }
                public static void DeleteAuthor(int authorId)
                {
                    // dao/db code here to delete the record
                }
            }
            class BusinessLogicLayer
            {
                DataTable authorTable = null;

                public void LoadAuthorTable()
                {
                    // Load records from DAL table...
                    authorTable = DataAccessLayer.GetAuthorTable();
                }

                public string [] GetAuthorNames()
                {
                    if (authorTable == null)
                        LoadAuthorTable();

                    // Load an array of author names to return to our GUI...
                    string [] authorNames = new string[authorTable.Rows.Count];
                    int ndx = 0;
                    foreach (DataRow dr in authorTable.Rows)
                    {
                        authorNames[ndx] = (string)dr["Name"];
                        ndx++;
                    }
                    return authorNames;
                } …
DdoubleD 315 Posting Shark

Yes, that's good that you are separating the code. However, in order to tell you how to convert a DataSet or rather your empDataSet to populate your Employee [] employees , I still need to know how each is defined.

For the "empDataSet", I assume that contains records from an Employee table or something, but I don't know what the table columns are...

For the Employee type, I assume it contains members that represent the DB columns from 'Employee' table, but I don't know what these fields are either...

I would like to mention though, that if your DAL is populating the DataSet with records that will match the structure of your Employee type, you might achieve the end result without any needed conversion at all between the DAL and the BLL because if your BLL expects a table containing columns with particular names, you can simply use the returned DataSet's Tables[0], which is a DataTable that can be accessed by column name such as: empDataSet.Tables[0].Rows[0]["Lastname"]; , which would give you the table's 1st row value for column "Lastname" if that is what it is called. Of course this code should be broken out to make it less cryptic, but I just wanted to demonstrate that you might not need to do any conversion from DataSet to a separate Employee [] type.


Example of breaking down the empDataSet.Tables[0].Rows[0]["Lastname"]; mention above:

// Retrieve reference to the Employee table from DataSet...
                DataTable dt = empDataSet.Tables[0]; …
DdoubleD 315 Posting Shark

More information is needed:

1) structure of Employee
2) structure/contents of the DataSet returned by: DataBaseLayer.GetAllEmployees();

DdoubleD 315 Posting Shark

if you want it to be accurate, you need to calculate up front the total items to be processed (scanned?), then divide into total items already processed * 100....

Here is an example of using BackgroundWorker with file copies in which the total number of bytes of all files to be copied are determined up front, then progress determined by bytes processed thus far: http://social.msdn.microsoft.com/forums/en-US/Vsexpressvcs/thread/a285bdb9-6838-48f3-b8ed-1bf0156f8c51/ Scroll down to the 1st post/reply by "NoBugs"

Here is an excerpt from that post where the author both: 1) builds list of files to process, and 2) calculates number of bytes that will be processed:

// Create list of files to copy
      string[] theExtensions = { "*.jpg", "*.jpeg", "*.bmp", "*.png", "*.gif" };
      List<FileInfo> files = new List<FileInfo>();
      string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
      DirectoryInfo dir = new DirectoryInfo(path);
      long maxbytes = 0;
      foreach (string ext in theExtensions) {
        FileInfo[] folder = dir.GetFiles(ext, SearchOption.AllDirectories);
        foreach (FileInfo file in folder) {
          if ((file.Attributes & FileAttributes.Directory) != 0) continue;
          files.Add(file);
          maxbytes += file.Length;
        }
      }
DdoubleD 315 Posting Shark

Sorry I didn't answer your original question, but Ryshad covered it. As I was looking through the code, I began finding areas of concern and that is what I noted--then forgot to mention checking that the event handler was being added...:(

DdoubleD 315 Posting Shark

Comments:

In your btnAdd_Click event:

private void btnAdd_Click(object sender, EventArgs e)
        {
            //execute the counter as incrementor
            Counter++;
            //declare variable as integer
            int arrayCounter;
            //compare the counter less than 20
            if (Counter <= 20)
            {
                //then arrayCounter will either add or equal to 1
                arrayCounter = Counter += 1;

1) You never use "arrayCounter".
2) You are adding 1 to Counter ( Counter += 1 ) before assigning it to arrayCounter, which means you have now added 2 to Counter since you entered this method

In line 20 of lstNames_SelectedIndexChanged , you are comparing apples to oranges, if (lstNames.ToString() == arrayName) , because the ListBox.ToString() will return something like "System.Windows.Forms.ListBox", and not the item of the ListBox. I believe you want to compare to your arrayString array, but you will never find the entry since you concatenated lastname with firstname before adding the item to the listbox, so the strings will never match in a compare unless reconstruct the concatenation for comparison...

Your array (arrayString) will hold 20 strings, but not 20 entries containing the following data for each entry:

Lastname
Firstname
Address
City
State
Zip

In order to accomplish this with your array approach, you need to make it two dimensional: string [,] arrayString = new string[20,7]; for example.

Well, that is a quite a bit to fix already. Start with that two dimensional array. I and others are dying to show you an alternative (List<>), …

DdoubleD 315 Posting Shark

I followed your suggestion using MDIParent VS default and changed my idea of use a lot child form in sequence. I will perhaps use panels or tabs, then hide or visible to false.

Only a little question, using MDIParent VS default which is the best way to create the form options (like menustip>Options>Configuration, then display a form) to interact to the childform? Create a winform without being child, then use "get and set"?

Thanks!

>>using MDIParent VS default which is the best way to create the form options (like menustip>Options>Configuration, then display a form) to interact to the childform?

The menu that it generates contains items that represent common menu features found in MDI applications. You can add/remove them to suit your own needs.

>>Create a winform without being child, then use "get and set"?

You may not want to use a MDI approach to what it is you are doing. Because of the way you were trying to implement the Form.MdiParent , I thought I should direct you to the "shell" Windows Form item type that you could add to your project that gives an idea of how to interact with a MDI Parent.

Here is a link to MSDN MDI programming...

It is not clear to me what the purpose of your application is, so I don't want to recommend one way over another. However, using the MdiParent property as you were attempting to do for each form without maintaining a …

DdoubleD 315 Posting Shark

I would learn both if I were you. I programmed in C/C++ for several years, and I will tell you that once I started coding in C#, I really don't like looking at C/C++ code anymore, but I can and do mostly for code conversions...:)

As far as which one is the future, I think C# is the way to go, but by having a C/C++ knowledge base you will be more valuable as there are huge amounts of legacy code out there that need to be converted and interfaced with; and, I believe the job market still favors C/C++ because of this huge weight.

If you decide that you like C/C++, don't fret, because there is and will be for a long time much code and work out there using this language. However, if you are like me and most others, once you get on the C# bandwagon, you won't want to get off!

Cheers!

DdoubleD 315 Posting Shark

All I did was look at this post and I hear sirens outside--just kidding. :D I can't wait to hear about everyone's experience once 7 has been out there a while...

Out of curiosity, unless it is intended for network upgrades, what is the effective advantage of automating this?

DdoubleD 315 Posting Shark

Thanks
I am reading a book named crystal reports for dummies. Just started!

I have to handle only a small data set. only 72 records. No different reports - only one report. I have no database, only a text file with these 72 records.
Will this huge report writer(crystal reports) be a overkill?
still may be useful in future projects, right?

Thanks

I think Crystal Reports is the most popular/versatile for the $price$ too. As far as the overhead it produces, that would be easy enough for you to determine. Just build one project with and one without...

There is a control in Visual studio called Microsoft Report Viewer. I think that is a simple report generator compared to crystal reports. Let me see weather I can use it for my purpose.
Also in Projects->Add New Items->Reporting-> report and report wizard. Just cant figure out what are the difference between these reporting tools.

Thanks
Roy Thomas

I haven't done anything with the built in Report Viewer and don't know much about it, but I will know more if you post your findings here. ;)

RoyMicro commented: Helpful +1
DdoubleD 315 Posting Shark

Overview:

Oddly enough, MS never created a TreeViewDrowDown or equivalent. What I mean, is a control that looks and acts like a ComboBox , but contains a TreeView instead of just a list when in the expanded drop-down mode. I've never understood why they haven't, but I always seem to want to incorporate such a control into a design/form. So, a few months ago while working on an application, I decided to create such a control (or rather fake it on a form) in C#.

In this particular example, I have a pseudo drop-down TreeView control that is intended to drive the contents of the TabControl on the form. However, I did not take the time to demonstrate this activity by populating the TabPages with other controls.:( Let it suffice to say, the "Drop Down TreeView" would drive the rest of the form (TabControl) in this example. In addition, the design and implementation herein is not really a custom control, or a UserControl for that matter, but rather a way to fake the appearance of a TreeViewDropDown control on a Windows Form. Here is a sample (runtime) of the form when the TreeView control is hidden:

[IMG]http://www.daniweb.com/forums/attachment.php?attachmentid=12681&stc=1&d=1258944292[/IMG]

And, here is what the control looks like when it is Visible (also at runtime):

[IMG]http://www.daniweb.com/forums/attachment.php?attachmentid=12680&stc=1&d=1258944292[/IMG]

The actual controls used to create this effect consist of a TextBox, Button (with down-arrow image), and a TreeView that get's made visible when active and then …

ddanbe commented: Nice snippet! +5
DdoubleD 315 Posting Shark

An MDIParent container paradigm has only one MDI parent, but you are using the MdiParent property for each successive form, which leaves the MdiParent property reference "dangling" if you close one of those forms, and also defeats having a Parent control...

I'm not sure, but it looks like you are trying to create an MDI Form from scratch? Did you know that there is an "MDI Parent Form" option from the VS -> Add New Item -> Windows Forms dialog? If you use this option to create an MDIParent Form, it will generate a lot code in the parent form, and you will see a method that looks like this, which gets called when you open a new form/document:

private void ShowNewForm(object sender, EventArgs e)
        {
            Form childForm = new Form();
            childForm.MdiParent = this;
            childForm.Text = "Window " + childFormNumber++;
            childForm.Show();
        }

If you really want to stick with how you are doing it, I can provide you a solution, but I'd rather make sure I'm not helping you find your way down the wrong path--if you know what I mean.

Let me know...

Be sure to read the above consideration. However, I got bored and made modifications to allow you to access any open form, but it will only work with one instance of each of your forms (eg. not two Form2 objects existing at the same time, etc.). There are a g'zillion ways to achieve something like this, and I usually try something different every time it comes up.;) …

DdoubleD 315 Posting Shark

An MDIParent container paradigm has only one MDI parent, but you are using the MdiParent property for each successive form, which leaves the MdiParent property reference "dangling" if you close one of those forms, and also defeats having a Parent control...

I'm not sure, but it looks like you are trying to create an MDI Form from scratch? Did you know that there is an "MDI Parent Form" option from the VS -> Add New Item -> Windows Forms dialog? If you use this option to create an MDIParent Form, it will generate a lot code in the parent form, and you will see a method that looks like this, which gets called when you open a new form/document:

private void ShowNewForm(object sender, EventArgs e)
        {
            Form childForm = new Form();
            childForm.MdiParent = this;
            childForm.Text = "Window " + childFormNumber++;
            childForm.Show();
        }

If you really want to stick with how you are doing it, I can provide you a solution, but I'd rather make sure I'm not helping you find your way down the wrong path--if you know what I mean.

Let me know...

DdoubleD 315 Posting Shark

I don't see anything right away that would prevent you from accessing that property. Can you zip up and attach your project?

DdoubleD 315 Posting Shark

But how I call in Fom3 for form1?

If i try to type form1.Text** any reference appears to the public string in form1...

Not sure what you mean. Are you still casting your form3.MdiParent to get your form1 reference? eg:

// in form3...
    Form1 form1 = (Form1)form3.MdiParent;
DdoubleD 315 Posting Shark

I've Contact My Manager host and He solved problem me. now I can connect my site with toad software but I receive error following When I wanted to connect C# to mysql.

An error occurred while retrieving the information from the database:
SELECT command denied to user 'itvan_jas'@'85.9.75.73' for table 'proc'

I found the following suggestion on the MySql website: "just add "Use Procedure Bodies=false" in your connection-string"...

You may wish to refer to this website as you continue, but feel free to continue feedback here as well.;)

Link to MySql: http://www.mysql.com/

DdoubleD 315 Posting Shark

In form1, you have defined a get property setter to retrieve the string value, which you can do from form3. However, if you want to set the value of the textbox control on form1 from form3, you need to create a setter set property too. The typical way to do this is to combine the properties as:

// in form1 class, define property (I called it TextBox1):
        public string TextBox1
        {
            get { return textBox1.Text; }
            set { textBox1.Text = value; }
        }

        // then, in form3 to set the value of form1.textBox1.Text:
        form1.TextBox1 = "some text";
        // or, to get the value in form3:
        string text = form1.TextBox1;
DdoubleD 315 Posting Shark

Hey Roy. I'm a little new to using the report controls shipped with VS, but they make life so much easier I think. Anyway, I want to see what recommendations others might make for you.

In the meantime, you could search the web for "CrystalReportViewer C# tutorial", or various other combinations to find a good tutorial on how to add this report viewer to your Form and how to design it to present your data the way you like. Hopefully you won't have any trouble incorporating your data into the design and building the visual presentation, but you could always ask about any problem with that too.

DdoubleD 315 Posting Shark

You are most welcome...Cheers!

DdoubleD 315 Posting Shark

It's really a simple concept once you get a grasp on why you want to do this. Although you might have already considered this, I would expand the design to ensure that the presentation layer is also separated.

The idea is to reduce the overall maintenance and increase the scalability of your application. For instance, by putting the data access layer into its own division, you don't have to touch the business layer should you decide to incorporate a new database, or you decide to use another database altogether. Same thing goes for the presentation layer, because if you decide to switch to some other GUI you will find it much easier if you have not embedded your business logic (methods) inside the form code...

For the functions you have listed, most of the methods should go into the business layer even though these methods represent what you are wanting to achieve with your form presentation. However, you can easily call these business objects (classes and methods) from the form code to achieve the desired outcome and maintain separation.

For the data access layer, that is where you want you OleDb, Sql Server, MySql, or other data access specific code to be contained. This data access layer would be called upon by your business layer to manipulate data to and from the database.

That is a very simple, high-level, overview of good object layer-separation.

DdoubleD 315 Posting Shark

This is a pretty good article as far as comparing Windows Forms to WPF at a high level: DECIDING WHEN TO ADOPT WINDOWS PRESENTATION FOUNDATION

To find examples of some technologies you are interested in, try looking on CodeProject.com and CodePlex.com.

Geekitygeek commented: really informative article :) +1
ddanbe commented: Yes, nice article! +5
DdoubleD 315 Posting Shark

Thanks a lot. This does solve the problem of passing unspecified number of arrays. I've never used a foreach loop before, and with the example that has been provided it would write one array per line. However, what I'm trying to do is write a value from each array next to each other. Is there a way to index the object array that is passed? Thank you all for you help this far.

Not sure what you mean, but here is the for/next index version with the arrays accessed by index:

public static void ProcessArrays2(params object[] v)
        {
            // for each array in variable arguments...
            for (int i=0; i<v.Length; i++)
            {
                Array ary = (Array)v[i];

                // for each item in this array...
                for (int ii=0; ii<ary.Length; ii++)
                {
                    Console.Write(ary.GetValue(ii));
                    Console.Write(",");
                }
                // Separate each array with newline:
                Console.WriteLine();
            }
        }
DdoubleD 315 Posting Shark

I choose option B :P
I will send you the code, but I prefer to send I through a private message. I also send you the MSA database in question as an attachment.

OK, I'll be looking for the attachment in the thread per your PM.

DdoubleD 315 Posting Shark

Hey there, I'm still not sure what you are asking because I asked a couple of different questions, and I'm not sure which one you accepted as your issue.:D Select a choice:

A) Are you trying to ensure that the "combine" table only has distinct values for two of the columns when the records are selected and inserted from the other three?

B) Or, are you only wanting to perform a query on the "combine" table (after it has been built) to determine if it has a row containing certain values for two of the columns?

In either case, and in order to expedite potential solution, please include the SQL statement(s) you are using to build the "combine" table.

DdoubleD 315 Posting Shark

Create a public method in your Form1 to access the control's text, then from the child form, just up-cast your MdiParent to Form1 and access the method:

// defined in Form1, or the MdiParent form...
        public void SetStatusLabelText(string s) 
        {
           toolStripStatusLabel.Text = s;
        }

        // to call from child form:
        MDIParent1 parent = (Form1) this.MdiParent;
        parent.SetStatusLabelText("some text for the status bar...");
DdoubleD 315 Posting Shark

Not a problem. Please mark thread as solved if your question has been answered--thanks.

DdoubleD 315 Posting Shark

It´s only to design user permissions into the menu.. my newbie idea is to pass user textbox value from login form and in other forms make a if cicle to check which user is and then disable or enable the menu items... it´s work? Can have some consequence? failure?

The most simplest would be how you indicated you were thinking of doing it, but that limits your design to predefined usernames you evaluate in your if statements (at least as I understood you to say). If you do it like this, I would still define levels of access (levelUser and levelAdmin for example) and then set the menu items accordingly rather than have two or more separate code blocks that manipulate all the menu items in each block for each user...

A simple approach would be to create a table to store each user and menu identifiers for each menu option, as a boolean field switched on or off (true/false) to indicate whether the user has permission or not (menu item enabled or disabled).

Another simple, perhaps simpler, approach would be to create a table to store each user with a corresponding access level (some enumeration of values like: level0, level1, etc.), then use the level of access to determine whether the user has permission or not (menu item enabled or disabled), depending on what level of access is required to access that menu item.

As a more complex approach, you may wish to do both in …

DdoubleD 315 Posting Shark

See if this article meets your needs: alternative to .NET Remoting based on low-level Windows Messaging...

In the above link (and code excerpts below):

  • the author uses the WM_COPYDATA message to broadcast and listen, but you should be able to define WM_USER +0x?? if that is your wish; but, he also forwards the message on (in WndProc) to other windows...
  • the author creates a hidden window when the listener object is invoked, which receives the window's messages via override of the window's WndProc...
  • the author uses a filter when enumerating the desktop windows, but you should be able to enumerate ALL open windows...

Excerpt showing SendMessage code:

// Use a filter with the EnumWindows class to get a list of windows containing
            // a property name that matches the destination channel. These are the listening
            // applications.
            WindowEnumFilter filter = new WindowEnumFilter(XDListener.GetChannelKey(channel));
            WindowsEnum winEnum = new WindowsEnum(filter.WindowFilterHandler);
            foreach (IntPtr hWnd in winEnum.Enumerate(Win32.GetDesktopWindow()))
            {
                IntPtr outPtr = IntPtr.Zero;
                // For each listening window, send the message data. Return if hang or unresponsive within 1 sec.
                Win32.SendMessageTimeout(hWnd, Win32.WM_COPYDATA, (int)IntPtr.Zero, ref dataStruct, Win32.SendMessageTimeoutFlags.SMTO_ABORTIFHUNG, 1000, out outPtr);
            }

Excerpt of listener (WndProc override) code:

/// The native window message filter used to catch our custom WM_COPYDATA
        /// messages containing cross AppDomain messages. All other messages are ignored.
        /// </summary>
        /// <param name="msg">A representation of the native Windows Message.</param>
        protected override void WndProc(ref Message msg)
        {
            base.WndProc(ref msg);
            if (msg.Msg == Win32.WM_COPYDATA)
            {
                if (MessageReceived == null) return; …
DdoubleD 315 Posting Shark
DdoubleD 315 Posting Shark

I get toad software and setup them
I tried connect to my site but I was faced with the following error
MySQL Database Error: Can't connect to MySQL server on '193.200.241.163' (10061) (Remembered answer : "ok" .)

Do you have access to the server? Have you tried google'ing "MySql cannot connect 10061"? Here is the first hit I got from that search: Can't connect to MySql (10061)...

DdoubleD 315 Posting Shark

Good point about that connection and stuff .
I already made an app in C# using MSA (which is MS Access) to alter a database and showing that database in a datagrid.
That database is the same that I'm using now.
The database consists 4 tables (items_1, items_2, combo, combine) and the first 3 tables mentioned have the columns (tablename)Id and Name.
The combine-table has the following columns:
Id, comboId, itemId_1, itemId_2

What I want is that I fill in 2 Names (from the items_x tables) and that my database checks if those 2 Names are use in 1 row in the combine-table.
What's needs to be done then, I already know.

I cannot tell from your last line whether you have already solved your problem. If so, please mark the thread as solved. If not, I will try to determine more clearly what it is you are asking...

Are you trying to ensure that the "combine" table only has distinct values for two of the columns when the records are selected and inserted from the other three?

Or, are you only wanting to perform a query on the "combine" table (after it has been built) to determine if it has a row containing certain values for two of the columns?

Or, have I missed completely what it is you want?:(

DdoubleD 315 Posting Shark

Are you asking how to find particular menu items, and then enable/disable menu items? Or, is your question more general about how to design user permissions into the menu design?

DdoubleD 315 Posting Shark

Hi,

No excuses: my problem is that I can't get my code to check if a certain record exists in a MSA database.

My code needs to check if the database contains a row where 2, 3 or 4 specified fields exist.
But, as mentioned, at the moment it only gives errors about missing parameters.
Before I post the code I'd like to know what the correct way is, as the code is very secret :).

Very secret...OK :cool: Here is an example of getting a count of records meeting a specific ID in a where clause:

using (OleDbConnection conn = new OleDbConnection(connStr))
                {
                    try
                    {
                        conn.Open();
                    }
                    catch (Exception Ex)
                    {
                        MessageBox.Show(Ex.Message);
                        System.Diagnostics.Debugger.Break();
                    }

                    string cmdStr = "Select count(*) from customers where id = 4";
                    OleDbCommand cmd = new OleDbCommand(cmdStr, conn);
                    int count = (int)cmd.ExecuteScalar();
                }
DdoubleD 315 Posting Shark

Try this for your functions.dll: Register .NET assembly...

DdoubleD 315 Posting Shark

C:\test\app.exe
C:\plugin.dll
C:\functions.dll
It doesn't work.

In the above scenario, have you tried running the app with "C:\" in your PATH environment settings?

It's not clear to me how your app is able to find and load the plugin.dll, but not the other. Could it be that the plugin.dll is registered and windows knows where to find; whereas this is not true for the functions.dll?

DdoubleD 315 Posting Shark

You might want to take a look at this thread: http://www.daniweb.com/forums/thread215125.html

It's a little lengthy, but if you don't find what you need in there at least it might help to explain better what you are looking for.

DdoubleD 315 Posting Shark
DdoubleD 315 Posting Shark

I suppose the main thing you are giving up is streamlined maintenance and scalability since you will need to manually copy and paste (or perhaps remove) segments of code anytime the size of the container gets changed.

Why are you avoiding loops?

DdoubleD 315 Posting Shark

To obtain the size of your list: properties.Count . To access a member of Property named pos in a loop:

for (int i=0; i<properties.Count; i++)
{
    if (player1pos == properties[i].pos) 
    {
          // but, this will error (using i+1) if "i" is already at Count-1:
         player1pos = properties[i+1].pos;
         x = x - 1;               
    }
  }
DdoubleD 315 Posting Shark

If I want to create the file (text file) in the current folder where my exe is running, how should I pass the file name argument in filestream instantiation?
Thanks
Roy Thomas

Hi Roy. If you pass in just the filename (no path), the file will be created in the same folder as where your application is running, which is the current working directory. The only caveat to this is, if your application's process changes the current working directory.

ddanbe commented: Clear explanation. +5