fishsqzr 0 Junior Poster in Training

Well, it is worth a try - I'll report back.

I checked this out and using a User Control just complicates the issue further.

I guess form inheritance is just one of those areas Microsoft didn't pay much attention to. Considering that they spent years trying to convince people that VB6 was OOP, I guess I shouldn't be surprised. I'll just copy and paste a lot of code instead of doing something more civilized.

Thanks for the suggestion anyway.

fishsqzr 0 Junior Poster in Training

Agreed, it is a little trickier in C# than some languages.

Would placing this datagrid in a user control and adding it to the forms work for you?

Well, it is worth a try - I'll report back.

fishsqzr 0 Junior Poster in Training

I am trying to use form inheritance in C#/NET 2.0 and find that some things (which were possible in other systems) do not seem to work here. Actually, even inheriting a form seems do be a bit of a chore (and the C# Help does not mention it at all).

In particular, some controls, if put on the parent form, cannot be managed in the child form. A good (and really obnoxious) example is DataGridView. If I put a grid on the parent form, I can do nothing with in in the child form - all properties are gray and I cannot add columns and so forth. Changing the Modifiers property of the grid in the base class does not help (although I have also noted that some controls other controls do not show up on the child form until they are at least elevated from private to protected).

I have a situation with a group of lookup tables which are very similar except for a few non-essential columns and other details which vary from table to table. Because of the above problem I must not only repeat design operations in each form, I must repeat event code in each one because I cannot add the grid until the child class is defined. This is very inefficent and it is not the only example.

Is there any way to get form inheritance to work like it does in other languages or is it just not supported very …

fishsqzr 0 Junior Poster in Training

That sounds like a good clue - the best so far anyway. Maybe I should just chuck in a different disk. I'm running a Dell Inspiron 1720, just for the record. Right now I must keep it running to get a quick job out the door, then it's back to the old downgrade path...

fishsqzr 0 Junior Poster in Training

In reply to the first response, the XP installer fails as soon as it loads because it cannot detect the hard drive, so the rest is a moot point. Vista will install just fine, apparently because the first time it was loaded it somehow modified the drive format. Actually, that isn't correct. The Vista install failed too until I eliminated all of the drive partitions during the format process. Before that, it would run for an hour and leave me with a totally black screen with a mouse cursor.

In response to the second reply, this machine is useless to me as-is anyway, so I could care less about details like the warranty and optimized hardware use (if that exists at all). This machine was available with either XP or Vista so it shouldn't matter that much. I was foolish enough to try Vista and I REALLY regret that decision.

I need to work with SQL Server, and it will not install properly under Vista HP because that OS does not expose IIS to the SQL Server installer, which means important SQL Server services are not loaded. Go on to the Microsoft forums and search for "Vista SQL Server" and see how many other people are complaining about this and other problems related to Vista's inability to support SQL Server and you'll see what I mean. I considered upgrading to a different Vista version, but the forums indicate that does not assure success either. I know damn well …

fishsqzr 0 Junior Poster in Training

I have had it with Vista HP, as it cannot support SQL Server at the level needed. Too bad Microsoft doesn't tell you about the problem (I found out by surfing their forums)

I've purchased an XP Pro disk, but now I discover that XP cannot see my hard drive! That is in spite of the fact that the format is supposed to be NTSF. I tried deleting all partitions with no luck. I tried running a nuke program and it couldn't see the drive either (which is on a Dell Inspiron laptop). Apparently Vista did something interesting to my drive which I cannot undo. I actually had to resinstall Vista just to use this computer again (and that was a lot of fun too).

Does anyone know how I can get this OS off of my computer so I can get some useful work done???

fishsqzr 0 Junior Poster in Training

C# (and, I assume, all NET languages) has a very obnoxious 'feature' where data is not sent from a control (TextBox, CheckBox, DataGridViewCell...) to the underlying dataset until that control looses focus. This causes problems because there are cases where critical code can get invoked before a value is saved.

I have tried all kinds of tricks to make sure all values the user has entered are sent to the underlying data but there seem to be exceptions to every tactic I try. Has anyone solved this problem?

fishsqzr 0 Junior Poster in Training

Let me explain a way to do this, step by step.

Open a new project. From the main menu select Data | Add new data source. In the Configuration Wizard select Database and then click Next. In the window labeled "Choose your connection" you will hopefully see your connection. If not, you can try to create it with the New Connection button but just what happens depends on what kind of data you are using (Access, SQL Server, ???).

If you find your data, click Next until you get to the window labeled "Choose your database objects". You need to open the Tables group and then select the tables you want to work with by clicking the little boxes next to the tables. Then, click Finish. NOTE-If any of these steps fail, you probably have not set up a valid connection to your data. Fixing that gets complicated and it depends on what your data is. If it is Access it is usually fairly simple to fix. If it is SQL Server, you may have a problem as there are a lot of variables and you will need help from someone who knows more than I do.

Now you have created a typed dataset. Use the VS menu to select Data | Show data sources You should see your data and the table or tables you selected. You can drag the table to a form to create controls. Run the program to see the actual data (VS …

fishsqzr 0 Junior Poster in Training

I haven't tried to run your code, but I can tell you this:
When your uncomment the line which moves to the next record, what is happening is that Delphi is calling OnCalc again automatically as soon as the record changes, and you are probably trashing the stack when the call goes into an endless loop because each call to OnCalc moves the record which send it back to OnCalc.......... OnCalc is best used to just update the current record (or other data dependent on the current record). It is a very useful tool (I sure with C#.NET had it) but it can't be used for everything.

I'm not quite sure what it is you're actually trying to accomplish but it looks like you are using the wrong event.

fishsqzr 0 Junior Poster in Training

Are you just dragging a connection component into your form and setting it up, or are you allowing Visual Studio to build a typed dataset? Or, maybe you are trying to drag objects from Database Explorer, which doesn't work.

First, you need a project open. Then on the C# menu, select Data, Add New Datasource. Go through the dialogs to indicate what you want to connect to, then VS will generate the connection, dataset, adapters and binding sources needed. The tables (and possibly other data objects) will be displayed in the Data Sources window. If it doesn't appear automatically, use the menu selection Data, Show Data Sources to open it. It is the Data Sources window which you use to drag tables and other data objects to your form to automatically add the controls and components needed.

Hope that helps.

fishsqzr 0 Junior Poster in Training

The Microsoft write-ups for Visual Studio 2008 said that it can target various version of .NET. However, it seems to set up all projects to target NET 3.5.

Does anyone know how to make it target earlier NET versions?

fishsqzr 0 Junior Poster in Training

Well, I was sure I'd tried that, but I was wrong - that works. Thanks.

fishsqzr 0 Junior Poster in Training

I need to use a BindingSource Filter property to search for names in a string field. That is easy enough, unless the name contains a single quote (apostrophe) such as "O'BRIEN" or similar names. VS Help says special characters should be escaped by enclosing them in square brackets. This works for some characters such as %, \ and even the bracket characters themselves, but it fails with a syntax error if I attempt to escape a single quote. I also tried to escape using \ but that doesn't work either.

Does anyone know of a way to use expressions to search for strings containing single quotes?

fishsqzr 0 Junior Poster in Training

I recently purchased Visual Studio Pro '08 and installed in on Vista HP. It comes with SQL Server Developer, but I disovered I could not get that to install correctly. From what I have discovered on other forums, Vista HP does not expose IIS properly to SQL Server so Reporting Services does not install at all and my passwords are not recognized by SQL Server even though I am the "administrator" on HP. The suggestion was to upgrade to Vista Ultimate (a bitter pill, at best) or downgrade to Windows XP. Visual Studio seems to work fine and lets me work with SQL Server Express, but I need Developer if I'm going to get any real work done.

Has anyone else seen this problem? Better yet - anyone know a solution?

fishsqzr 0 Junior Poster in Training

I have that enabled. I have stopped and restarted IIS. I have read elsewhere that Vista UAC is the problem.

fishsqzr 0 Junior Poster in Training

I'm trying to install SQL Server on a Vista HP machine, but it will not detect IIS, which in turn prevents Reporting Services from being installed. I have seen blogs which indicate that the UAC system in HP does not properly detect IIS and that as a result NOTHING can be done. If that is true, I guess I should have stayed with XP Pro (which I'm pretty sure of anyway).

Does anyone know if there is a way to get SQL Server properly

fishsqzr 0 Junior Poster in Training

I've used Delphi since version 1 and I've used C# for several years now. The ONLY reason I use C# is because it is a requirement of a big project I am working on. And, those requirements were specified for all of the wrong reasons, so far as I'm concerned.

The Delphi and C# languages are reasonably similar (both were designed by the same person). C# has generics, attributes and better handling of interfaces. Delphi (Object Pascal) has much better structure, class referencing, mathematical sets, data modules and so forth. I wish there was one language which had all of the above since all of those things are useful. In the end, you can get the work done with either language, you just have to go about things differently.

However the REAL difference is in the libraries. The Delphi VCL is far more mature and a much better design than NET. I have been continually frustrated by the poor design of some parts of NET. It is a huge and complex system, but it seems like much of it is of little use for real-world projects. On the other hand, it is missing a lot of things which VCL provides and some of what it does provide doesn't work as expected. I find ADO.NET to be particularly bad. There is no equivalent of the Delphi DataModule class, for instance. The "disconnected dataset" concept would be great if it could do all of the things a connected dataset can …

fishsqzr 0 Junior Poster in Training

You can extract the name of each element in the enumeration (with ToString) to use that for your name, but you couldn't use an illegal name (like something containing a space) when creating the enum structure.

You would be better off to use a collection of objects of a custom class with a string for the name you need to display and an integer (or any other kind of object) as the 'value'. Then you could use the values of the list items in place of enums. See the Help for "generics" for ways to do that.

This is a typical class for this purpose. Note that it uses a integer for the 'value', but you could change that to an integer, character or whatever else is needed (or just cast the object, if you want to take your chances).

public class NameValuePair {
        string name = "";
        object value = null;

        public NameValuePair(string name, object value) {
            this.name = name;
            this.value = value;
        }

        public string Name { get { return name; } set { name = value; } }
        public object Value { get { return value; } set { this.value = value; } }

        public override string ToString() {
            return name;
        }
    }
fishsqzr 0 Junior Poster in Training

I have a simple DragAndDrop sample which should move a string from one ListBox to another. The string gets dropped, but it is not removed from the source even though Move is specified. Where have I gone wrong? Here is the code:

public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e) {
            string[] items = { "Hello", "GoodBye", "World" };
            foreach (string item in items)
                listBox1.Items.Add(item);
        }

        private void listBox2_DragEnter(object sender, DragEventArgs e) {
            if (e.Data.GetDataPresent(typeof(string)))
                e.Effect = DragDropEffects.Move;
            else
                e.Effect = DragDropEffects.None;
        }

        private void listBox2_DragDrop(object sender, DragEventArgs e) {
            listBox2.Items.Add((string)e.Data.GetData(typeof(string)));
        }

        private void listBox1_MouseDown(object sender, MouseEventArgs e) {
            DoDragDrop(listBox1.Items[listBox1.SelectedIndex], DragDropEffects.Move);
        }
    }
fishsqzr 0 Junior Poster in Training

The finally clause is a good idea that I will adopt. In this particular case I could use a stored procedure. I use a search system which is totally dynamic and could not be done with parameters as there would be thousands of permutations. I use a parsing system to construct the queries on the fly. Since the application is a database for fisheries work, it isn't likely to be the target of mishchief anyway (we hope). Thanks for the tips.

fishsqzr 0 Junior Poster in Training

I prefer using the SqlCommand as well. One approach is to create a method (even perhaps a static method) that you can pass a T-SQL statement, and it does all the work, or you can pass a stored procedure name and a array of parameters for the proc to use. Comes in real handy.

Actually, using the command ExecuteNonQuery method uses a generic connection and works fine. I try to avoid parameters whenever possible because the are too specific. Here is a generic method (put into a static class) which seems to work. Note that the table involved must be cleared and filled again before the changes are avaliable in the DataSet. This might seem a bit complicated, but the update I need in this case reflects a very complex business rule which would take a number of additional steps if I had to update the data in memory and send it back out using a data adapter. The SQL is actually a much simpler way to go. And now that I have the generic method, it will probably prove useful elsewhere. Here's the method...

public static void ExecuteNonQuery(DbConnection cnn, string sql) {
            DbCommand cmd = cnn.CreateCommand();
            cmd.CommandText = sql;
            cmd.CommandType = CommandType.Text;
            try {
                cnn.Open();
                cmd.ExecuteNonQuery();
                cnn.Close();
            }
            catch (Exception ex) {
                MessageBox.Show("Update failure in Global.ExecuteNonQuery" + Environment.NewLine
                  + ex.Message);
            }
        }
fishsqzr 0 Junior Poster in Training

For the work I am doing, direct SQL is preferrable to ANYTHING Microsoft has to offer. It is simple and to the point and most things can be done with a single command, which is easily constructed given the toolset I use. I'm just trying to find the best way to get that done without going through a bunch of intermediate layers. While disconnected datasets certainly have their uses, they can also be a royal pain for some kinds of operations. For the case at hand, sending a SQL command directly to the database is far more efficient and easier to program than loading, modifying and updating using adapters and a DataSet.

It turns out it doesn't matter. I have discovered that Command objects can indeed be used to send commands directly back to the database using adapter command objects.

fishsqzr 0 Junior Poster in Training

Yeah, I knowI can do it the 'correct' way. That sounds like an unnecessary complication. I want to avoid as much M$ Mickey Mouse as possible. Operations like this are a lot easier in other environments.

fishsqzr 0 Junior Poster in Training

I have a highly specialized update operation which I must occasionally run against a table. I would like to just send the SQL directly to the database as an UPDATE command. I have a data adapter for the table which handles normal read/write operations but this is a special case.

Can I get away with creating a secondary data adapter and supply it with an UpdateCommand (with the appropriate CommandText) then call the Update method of that adapter? I don't want to mess with the parameter list of the UpdateCommand of the primary adapter if I don't need to. It would be a lot easier to just generate the SQL directly.

fishsqzr 0 Junior Poster in Training

If your children ever find out how lame you really are they'll murder you in your sleep.

Frank Zappa

fishsqzr 0 Junior Poster in Training

Does anyone know of a way to force input to the cells in a DataGridView column to be uppercase?

fishsqzr 0 Junior Poster in Training

I have a table with a column containing a single character representing what type of animal described by the record. I have a comboBox which has the Items property filled with the descriptions corresponding to each code. Example "A" = Amphibian, "C" = Coldwater fish... and so on).

What I need to ComboBox to do is display the description corresponding to the current code, when the user changes the selection, the underlying code character should be altered accordingly. Do I need to do this through code, or is there a way to set up a relationship using the ValueMember and DisplayMember properties?

If the value being mapped is an integer instead of a character, can it be done then?

fishsqzr 0 Junior Poster in Training

please give me your pc's serial number and manufacturer so i can find your pc's exact specs so i can see where your pc needs upgrading to handle vista and make it stable.

P.S. Is this preinstalled vista or vista on top of a preinstalled xp.

This a new Dell Inspiron 1720, factory installed Vista with all automatic updates enabled (and God knows that takes up a bit of my time too). If M$ can't update me, I'm sure not going to start passing out personnal information to a total stranger (not to mention the rest of the forum). On a positive note, I have discovered that my Bluetooth mouse now remembers its tracking speed, so something got fixed (somehow) anyway. Of course, it suddenly quit working without waring and I had to reinstall it, but at least once I did that it works better.

Don't get all defensive about Vista. You have your right to love it if you like. I reserve the right not to.

fishsqzr 0 Junior Poster in Training

Less complexity for Microsoft, more work for the users. Does anyone know if C# Pro or any of the other versions add it?

fishsqzr 0 Junior Poster in Training

Sorry, I've been using Vista nearly six months and I've just learned to ignore it as much as possible. A few things are better, but I've found the system less than stable and less than convenient as well. The Help is pathetic, which doesn't make it easier to learn to use. Part of my problem is I bought Office '07 with it, which has been more of the same, not to mention the great fun I'm having trying to get NET to do what I want using C#. I am an experience user. I find it difficult to find the things I KNOW should be available. I don't have time to worry about all of the nice new features I'll probabaly disable if I come across them. I just want to get my work done. Vista HAS NOT helped.

fishsqzr 0 Junior Poster in Training

Is there a way to see a list of the breakpoints (active or not) in C# Express?

fishsqzr 0 Junior Poster in Training

If we expect Upgrade OS then why not we want to upgrade our Hardware?? Vista needs more hardware because its worth of that wait for the Microsoft Next Big release Windows Vienna( BlackComb) that will change the definition of Operating systems !!
I am Microsoft Certified Technology Specialist ( WIndows Vista) thats why i am fan of Vista i suggest explore the whole vista and m sure you will find it best


Regards

Gee, where have I heard that before? I consider an upgrade to be a system which provides more capability that the previous version, does not discontinue any useful capabilities of the previous version, it at least as stable as the previous version, and is at least as easy to use as the previous version. I don't believe Vista meets those requirements very well, and I'm certainly not waiting on the edge of my seat for Microsoft's next great idea.

fishsqzr 0 Junior Poster in Training

I have been using Vista Live File System to keep backups of programming code. Each day, I use Windows Explorer to add a new folder named according to the date (example: "080114") and then I copy files as needed to that folder. Then I close the session. I am finding that this works well for a while and then at some undetermined point, Vista can no longer read anything on the disk, although it does report the correct amount of used space. In some cases, another (XP) computer can read the CD and recover the data, in some cases no computer can read the CD.

I am careful to make sure there is plenty of space on the CD and I am careful to close the session each time. In some cases, the error occurs after I remove the CD for some reason and then return it to the computer. However, in some cases, removing the CD does not cause a problem and in some cases I get the problem without removing the CD at all. I suspect that Vista is not properly closing the session on all occasions even when I am careful to follow the same procedure each time.

Has anyone else had similar problems? I don't know whether to blame this on Microsoft or a hardware problem. This is certainly not the only problem I have seen in Vista, so I am assuming a software problem right now. I am just about ready to reformat …

fishsqzr 0 Junior Poster in Training

I've had Vista for about 6 months and I HATE IT. I bougth a new Dell laptop with good specs (and I maxed out memory and got a generous drive to boot) and had Vista factory installed. It has been nothing but trouble. It is slow, unreliable and prone to problems. It constantly updates itself, but nothing seems to improve. It has already used over 40 GB of disk space (and I have VERY LITTLE on this machine except Vista, Office and C# Express). My old XP machine only had a 40 GB drive, and I never filled it up the entire time I used it. I cannot rely on the Vista CD writing software at all. It constantly looses the ability to read and write CDs which it could use the day before. The Help is a joke, but not quite as bad of a joke as the Help for Office 07, which is really pathetic. In short, I wish I had paid EXTRA to get XP instead of Vista. I would be a lot better off now.

I have never been a big fan of the Mac OS-Xuser interface, but when I look at my wife running a five year old Mac which consistently outperforms my new PC, and never causes her any problems, I wonder just how M$ keeps shoving this JUNK down our throats, with no end in site. The Mac adds are right on.

fishsqzr 0 Junior Poster in Training

My applications are targeted to aquatic sciences, and some of the logic and equations involved are not the kind of thing you'd want to do in SQL. Also, I need to keep open the option of handling alternate databases which do not support the operations required, or even stored procedures at all.

So, I guess the way I'm doing it is all that can be done. And yes, I am indeed iterating the table (right after Fill), updating the calculated data with the same event which is used during the rest of the session. It works, it just introduces a lot of overhead when a form opens if the dataset is large.

Anyway, it never hurts to check.

I guess

fishsqzr 0 Junior Poster in Training

I need to use C# methods to set the values of some DataColumns in a table. DataColumn provides an Expression property, but that only allows a subset of SQL style calculations on the dataset. What I need to do is call a C# method to perform calculations too complex for the Expression syntax and then put the data into a row’s column. I would like that value to be set when the data table is loaded and again whenever the current row is updated, at least.
Is there any way to implement a true calculated field in ADO.NET? When I used Delphi, you could use the designer to add a calculated field to a table and define the event which updates it, and the event would be called as needed. I can’t seem to find an equivalent in ADO.NET.
DataRow, DataRowView and DataColumn have no events of use. I am not allowed to edit data in the DataTable.RowChanging event. If I edit in the RowChanged event it causes an endless loop because you’re changing the row again. The various events of the BindingSource only work on the currently selected record (useful for the second case, at least).
The only solution I have found to date is to call my method in BindingSource.CurrentChanged. That only fills the current record, so I must step through all of the rows in my DataTable immediately after a Fill operation to trigger that event to set the initial values. That’s a bit …

fishsqzr 0 Junior Poster in Training

The C# language itself is not going to be the problem. It is a pretty useful language overall. Your big problems will come from the .NET libraries which make everything work.

I've been using C# for a over year now and still have major problems finding out how to do things which were obvious in other systems. And, I have 30 years of programming experience, so I know what needs to get done. .NET manages to be unnecessarily complex and unreasonably inflexible all at the same time. There are usually solutions to the problems you will face, but they aren't always easy to find. Forums like this one are often more help than the documentation.

Good luck!

fishsqzr 0 Junior Poster in Training

I found a better way - use the ContainerControl.ActiveControl property. So, in a form, you can just use this.ActiveControl .

fishsqzr 0 Junior Poster in Training

Does anyone know how to determine which control on a form currently has focus?

fishsqzr 0 Junior Poster in Training

Excellent! I imagine that same trick can be used with the other buttons. I'll try it. Thanks.

fishsqzr 0 Junior Poster in Training

When the user clicks the Delete button on a BindingNavigator, the delete occurs immediately.

I can arrange for the user to cancel the delete later, but that assumes the user realizes that a record was deleted in the first place, so I prefer to warn them when the button is clicked. I would like to display a dialog asking the user to confirm the delete operation before hand, and cancel the delete if the user does not confirm it. I have not identified a good way to do that.

The row is already deleted by the time the Click event on the button occurs.

The DataTable.RowDeleting event does not provide a Cancel property in DataRowChangeEventArgs.

Is there a way to trap this event

fishsqzr 0 Junior Poster in Training

No, they are there, but they are in the Common Controls section instead of the data section. And, they seem to work just fine.

fishsqzr 0 Junior Poster in Training

Thanks. The first, using cell validation, would have required events for every cell so I didn't try it. The second, using the DataError event, works for me.

fishsqzr 0 Junior Poster in Training

This may be a NET bug, but maybe I'm missing something. I've been trying to trap a certain kind of error when using a DataGridView. The following describes the steps to generate the error. I used a typed dataset to make the example quick, but the same thing happens if an untyped dataset is used.

Example:
Create a new application.
Use the Add New Datasource dialog to add typed dataset with any table which has at least one column with a constraint. Drag the table from the Data Sources window to your form. Designer will add a datagrid and navigator with the support data objects.
Run the program.
Click the Add new button on the navigator to create a new blank record.
Click on any other row in the grid. You will get an exception from the datagrid becuase the constraint was violated. The message displayed is nothing you want your users to try to comprehend. Also, the new record apparently is deleted.

When this kind of error happens, it would be much better to display a civilized error message to the user and then return to the record which was being added. I have spent two days trying to find the right way to do that. Any ideas would be appreciated.

ps-a hint about my login - I used to run a salmon hatchery.

fishsqzr 0 Junior Poster in Training

I can't seem to get OleDb controls to show up in C# Express. Are they excluded for some reason? I have made sure they are selected in the "Choose Toolbox items..." dialog, where they are listed, but they don't appear anywhere on the toolbar.

I tried to add them to my project References list, but the namespaces is not exposed in that dialog either. The interesting part is that I can go ahead an use them in code so long as I add "using.System.Data.OleDb". Using them in code alone is a pain.

Does anyone know how to get them to the toolbar?

fishsqzr 0 Junior Poster in Training

Thanks. That was a stupid mistake on my part, and I didn't know about IsNullOrEmpty at all.

fishsqzr 0 Junior Poster in Training

In that case, C# has a bug. I have a class with a string named FieldName. Until the string has a value assigned, it is null. I want to test for null, but I also want to see if the string has been assigned an empty string (a string with length zero) since there are situations where the user may erase its contents. So, I use the following

if ((cr.FieldName == null) | (cr.FieldName.Length == 0))
                throw new Exception("Null FieldName in SQLNumStrategy");

If short-circuit is working right, it should never check the FieldName.Length property if FieldName is null becuase the result of the statement is already known. However, it does try to check, which raises a different exception (with the wrong message). I find I must break up the test into two separate if statements, testing for null first. Then, if FieldName is null, the correct exception is thrown and Length is never checked.

Other kinds short-circuit evaluations seem to work, so the bug appears related to the test for null. I guess this is just yet another C# 'feature'.

fishsqzr 0 Junior Poster in Training

Does C# allow short-circuit evaluation of Boolean expressions? That is, if you have an expression such as
if (test1) & (test2) {....}
when test1 is false, there is no reason to evaluate test2 and a language which supports short-circuit evaluation never looks at the second test because the result will obviously be false. From what I can tell, C# doesn't do that, at least by default. Is there a compiler directive or attribute which will allow that?

fishsqzr 0 Junior Poster in Training

I am not directly using SQL, but I assume the C# environment is. I am from a Delphi/Access environment. C# has been no problem but SQL Server has proved a puzzel. I will try to give an exact description of what I am doing:

In SQL Server Express
Right-click Databases and create a new one.
In the NewDatabase dialog, Owner is set to <default>.
Check for other owners. In Select Database Owner dialog, there are no objects listed. Do I need to create a user first?
Create the new database using Owner of <default>, create a new table and run a select query. No error, and the results pane displays the fields from the table. So I assume I am properly connected in SQL Server.

Go to C# Express, create a new project and use Data | Add new data source wizard. In the connection dialog, click the New connection button. In the Add connection dialog Data source is set to Microsoft SQL Server Database File (SqlClient), use Windows authentication, navigate to the database, and select it. I get the error listed in my first post. I have also tried using SQL Server Authentication with my usual passwords.

fishsqzr 0 Junior Poster in Training

I'm using C# Express and SQL Server Express. I can connect to sample databses I have downloaded to the default location (..\MMSQL.1\MSSQL\DATA) but I cannot connect to a new database I create using SQL Server. The error is "You don't have permission to open this file. Contact the owner or administrator to obtain permission". I'm the owner, of course.

I can create a new database directly in a C# project and put it together, but I cannot see it from SQL Server.

I can connect to Access databases without any problems.

Is this a limitation built into C# Express and SQL Explorer Express because they are essentially free samples, or am I missing something obvious?