JerryShaw 46 Posting Pro in Training

Well, is this RFID reader transmitting over sockets ?
Most RFID readers are serial (Com) or USB devices. When incorporated into a hand-held or POS unit the information surrounding the RFID is usually wrapped along with other information as to the location (register, etc).

So your question must be expanded to included the source of the TCP data.
Setting up a socket is not all too difficult. Managing the data that it receives, making authenticated connection to the other end, protocol to use, port, etc. that is where some planning and information come in to make it a successul project. Do you have all this information ?

Is the data being transmitted / received in plain text ?
Is in coming in as a delimited string ?
Is it an XML stream ?

Once you have all the needed information, and pass the code you have done so far, I might give you a helping hand.

// Jerry

JerryShaw 46 Posting Pro in Training

Since this thread has been dragging on for some time, and there have been a number of members wanting to see how to do this, I went ahead and created a simple demo project in VS2005, although it should also work fine in VS2008.
It is attached to this message.
UnZip it to a new directory, and read the notes at the top of form1.cs.

// Jerry

Jens commented: It's nice to see someone making stuff for people in need after working hours. Most of the time I am beat when I get home. I am going to take a look at your code though, since I think it might learn me a thing or two. Thanks +1
JerryShaw 46 Posting Pro in Training

rsimlote,

Files or any binary data is stored in SQl Server as a byte array.
Placing a file into SQL, means placing the file into a stream (of bytes), and then save that
to the column.

Likewise when extracting this binary data to be used by another application, it is a matter of reading the bytes from the column and writing them to disk, and finally executing the file.

This means that you will need to store more than just the bytes of the file. You will also want to save some file information such as the FileName, or as a minimum, the file extension. In a recent project, I also saved the DateTime as well so that I could reset the file to the correct name and date criteria. I also included a checksum that I could test to make sure that what I wrote to disk is exactly what I originally copied from disk to SQL.

If you want an example of saving to SQL, retrieving from SQL then executing it (something like an Excel or Word file), let me know and I can whip one up this evening after work.

Regards,
Jerry

JerryShaw 46 Posting Pro in Training

Have you tried using Reflection ?
You can create a delegate to handle the method signature. This will let you compile the component. Maybe you can reach into the VB form using reflection (at run time) to grab the method(s) address you need, and Invoke the delegate against the discovered method address.

Do you have ownership of the VB code ? (IOW can you make changes). Like receiving windows messages ?

Is the virtual keyboard external to the VB app (IOW can you call it directly from your component) ?

Wish I could help, but I am shooting in the dark without some sample code to go on.

// Jerry

JerryShaw 46 Posting Pro in Training

I assume that the functions to display and hide the virtual keyboard are in the VB code, and that you wish to use those functions instead of controlling it from your component ?

Is the c# component initialized in the VB form on startup, or is it dynamically created through the onClick event ? and later disposed ?

Is your onClick event on the c# component or the VB code ?
Your component's parent is the VB form. You should be able to cast the parent object as the VB form class, and call any of its public methods.

If you need to keep the keyboard logic in the VB app, you can setup an event in the C# component that will allow the VB programmer to assign an event handler.

Goes something like this: your component has an Event named onRequestVirtualKeyboard
Your VB application would assign an event handler to this event, and when you invoke this event from your component, then the VB app takes care of the keyboard management.
Likewise you can have an event such as onDoneWithKeyboard.

Your c# event can be as simple as:

public delegate void RequestKeyboard(object sender, EventArgs e);
        public event RequestKeyboard onRequestKeyboard;
        private void StartSomethingNeedingAKeyboard()
        {
            if (onRequestKeyboard != null)
            {
                onRequestKeyboard(this, null);
            }
        }

Hope this helps,
Jerry

JerryShaw 46 Posting Pro in Training

Setup a Delegate and an Event in the C# component that can be assigned by the VB code on the main form. When your component detects the condition where you want to fire something or deliver information back to the main form, it will be done through the event.

// Jerry

JerryShaw 46 Posting Pro in Training

The account must exist on the remote computer, or in the active directory where that account has rights to the computer.

Optionally, you can use impersonation of an existing account on the remote pc.

Even though it is a service account, it still must comply with all Windows security requirements.

//Jerry

JerryShaw 46 Posting Pro in Training

Did you trace through the code with the debugger ?
Is there actually a bitmap file with the user's name in that directory ?

// Jerry

JerryShaw 46 Posting Pro in Training

The target computer "MUST" have dot net installed , and the correct version of dot net to run a c# Windows form application.

If you are saying that it doesn't run in a seperate folder on your development machine, then you either 1) have a partial path hard-coded, or 2) you are missing one or more files required by the application.

// Jerry

JerryShaw 46 Posting Pro in Training

If you really need to do it in a listbox then look at:
OwnerDrawListBoxWithIcons

Most folks use a ListView instead because it does everything a listbox can do (and more) and handles the image easier through its smallimagelist property. If you want to see some code on using the listview, let me know.

// Jerry

JerryShaw 46 Posting Pro in Training

Are you aware that the Jet engine is very picky about the dBase file version. This is why I prefer to use the ODBC classes instead of Ole.

I had a similar problem using your code, and after switching it out to use ODBC, everything worked fine, and even a little faster.. go figure.

// Jerry

JerryShaw 46 Posting Pro in Training

Found a way of doing this using SMO.
The MSDN website has some almost useless (as usual) examples, but it should point you in the right direction.

JerryShaw 46 Posting Pro in Training

SQL is a service. Therefore using the NET START syntax for a remote machine might get it done.

JerryShaw 46 Posting Pro in Training

What does this class do ?
Care to post the class to allow someone to assist you in this effort ?

JerryShaw 46 Posting Pro in Training

I have no idea why anyone would ever want to do this, but here you go...

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBox1.SelectedIndexChanged -= comboBox1_SelectedIndexChanged;
            int i = Convert.ToInt32(comboBox1.SelectedItem.ToString());
            int j = Convert.ToInt32(comboBox1.Items[comboBox1.Items.Count - 1]) -i;
            
            comboBox1.Items.Clear();
            for (int z = 1; z <= j ; z++)
                comboBox1.Items.Add(z.ToString());
            if(comboBox1.Items.Count > 0)
                comboBox1.Text = comboBox1.Items[comboBox1.Items.Count - 1].ToString();
            comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
        }

// Jerry

JerryShaw 46 Posting Pro in Training

Yes you can do this. I have a service that does this type of work for archiving files.
Remember that a mapped drive is in the context of the currently logged on user. A Windows service runs in its own context. So, your mapped drive may not be visible to the windows service account.
If the service account has the security rights to the remote machine, then you can perform IO with it using the fully qualified path.

I use a fully qualified path instead of a mapped drive. You may have to either have your service create the mapping on startup, or just use the full path.

JerryShaw 46 Posting Pro in Training

If you are talking about the dropdown height, there is a property for that setting.

JerryShaw 46 Posting Pro in Training

What is bnf ?

JerryShaw 46 Posting Pro in Training

First off, your scoping is wrong.

You have declared this in your constructor:
col c1 = new col();

The milisecond that your constructor exits, c1 is out of scope and ready for the garbage collector.

Declare your components (not initialize them, just declare them) in the class but not inside the constructor or any other method:

public partial class Form1 : Form
    {
        private col c1 = null;

        public Form1()
        {
            InitializeComponent();
            this.Text = "Nim";
            c1 = new col();

// Jerry

majestic0110 commented: Nice work mate! +2
JerryShaw 46 Posting Pro in Training

Change:
("c:/data/theData.txt",
TO
("c:\\data\\theData.txt",

and try it again.

// Jery

JerryShaw 46 Posting Pro in Training

Then you have something else wrong with your code. If you can provide some demo code that can reproduce your problem, I would be happy to look at it.

// Jerry

JerryShaw 46 Posting Pro in Training

DOS commands occur in "that" process. So, the cmdshell does accept the and act upon the CD directive, however, once that command shell closes, the process of changing directories has nothing to do with the next command shell directive because it would be in a new shell.

Maybe what you are looking for can be found at this URL
http://www.codeproject.com/KB/miscctrl/commandprompt.aspx

JerryShaw 46 Posting Pro in Training

big_B,

Okay, there are several ways to do it, so this example is but one of them.
I have two forms , first form has a button, second form has a timer, and two labels.
The one second timer simply posts the time to label1.
The second label is used to illustrate passing a string value from the main thread(or any other thread) to update its text.

// Form1
public partial class Form1 : Form
    {
        private Form2 f2 = null;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (f2 != null)
                f2.setLabelText("Hello World");
            else
            {
                Thread x = new Thread(LoadF2);
                x.IsBackground = true;
                x.Start();
            }
        }

        delegate void f2Unloaded(object sender, FormClosedEventArgs e);
        void f2_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (button1.InvokeRequired)
            {
                f2Unloaded d = new f2Unloaded(f2_FormClosed);
                this.Invoke(d, new object[] { sender, e });
            }
            else
            {
                f2 = null;
            }
        }

        private void LoadF2()
        {
            f2 = new Form2();
            f2.FormClosed +=new FormClosedEventHandler(f2_FormClosed);
            f2.ShowDialog();
        }
    }

The button on form1 will either post text to form2 or start form2 in a new thread depending on if form2 is active.
If it is currently null (not active), then create a new thread, and call the LoadF2 method.
We have to know when the thread has released form2, so we assign an event handler to its FormClosed event.
It starts form2 as modal. This is important, because if you just show form2, then the thread will exit, automatically disposing …

JerryShaw 46 Posting Pro in Training

If you are doing the backup and restore on the same SqlInstance, it is trivial.
Just use the SQL backup and restore syntax into an SqlCommand.

If going between SqlInstances, it can be more challenging. Databases using multiple file group require the target directories to already exist, although you can specify a MOVE to force the files into an existing directory of your choice. But first you need to find out what files are in the backup file. Then you have to synchronize logins SIDs because the SID will be different between SQL servers.

I am wrapping up a c# utility named SqlRestore that does all these things (and many many more), but I use SMO to figure out what is in the backup file before trying to restore it. I use SMO to perform the restore as well. SMO is (dot-net), and has many fetures that allow you to do all the things found in Studio.

So, the quick answer is, it doesn't matter what language you use to perform a backup & restore, it will eventually be done by SMO anyway (even Studio uses SMO under the covers). C# is as good as any to launch the task.

// Jerry

JerryShaw 46 Posting Pro in Training

Here is an example. You can also tack on a p.WaitForExit(); if needed.

using System.Diagnostics;
.
.
.
            Process p = new Process();
            p.StartInfo.FileName = "IPCONFIG";
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.Arguments = "/all";
            p.StartInfo.RedirectStandardOutput = true;
            p.Start();
            textBox1.Text = p.StandardOutput.ReadToEnd();

// Jerry
if this solves your issue, please remember to mark it as solved.

JerryShaw 46 Posting Pro in Training

It all depends on when you are letting the user delete the file.
Even through the dialog is closed, does not mean it has been disposed by garbage collection.

To insure you no longer have the picture file handle open, before closing the dialog (or in the FormClosed event handler), set the picturebox image to null.

pictureBox1.Image = null;

This frees the handle, and allows you to perform the delete.

// Jerry
If this solved your problem, please mark this message as solved.

JerryShaw 46 Posting Pro in Training

Can you send your project to me. You can rar or zip it, and use the additional options under the reply message to attach the file.

I placed your code into a new project, and it works fine. I pressed the new buton to get the picture boxes to appear, and as each click would provide the answer, and reshuffle the pea.

I did make a small change to your code. I set the Tag property to 1,2 or 3 for each picturebox. Instead of having an event handler for each picturebox, I use one. here is the code:

public partial class Form1 : Form
    {

        private Random RandomNumber = new Random();
        private int x = 0;
        private int counter = 0;

        public Form1()
        {
            InitializeComponent();
        }

        private void btnNewGame_Click(object sender, EventArgs e)
        {
            shellOne.Visible = true;
            shellTwo.Visible = true;
            shellThree.Visible = true;
            x = RandomNumber.Next(1, 4);
        }

        private void onCupSelected(object sender, EventArgs e)
        {
            Button cup = (Button)sender;
            textBox1.Text = (x == (int)cup.Tag) ? "Good" : "Bad";
            counter++;
            if (x == (int)cup.Tag)
                x = RandomNumber.Next(1, 4);
        }
    }

// Jerry

JerryShaw 46 Posting Pro in Training

The question just has to be asked..... Why are you invoking the second form this way ?

If your intent is to have the first form freeze and wait until the second form closes, then why not just show the second form as model using ShowDialog() ? That is the normal behaviour in windows applications.

Launching a second form from a thread has no advantage. When a form is launched in a windows application is stacks the form instances on the main application list of forms. This is how the windows dispatcher finds the form.

You can show many forms at once using show, all of them capable of accepting user interaction.
You can cause all forms to freeze by using ShowDialog on a form. When it exits, focus it brought back to the form that launched it.

If the Form is in another thread (yes you can do this... although not a good idea) then communicating with it has to be done through delegates to event handlers that will invoke into the owning thread. Alot more trouble than it is worth, since Windows can handle anything you need to do in the main thread. You can feed the second form from a thread easily enough, and is the main way programmers do it.

// Jerry

JerryShaw 46 Posting Pro in Training

Curious as to why you are using the Jet driver ? (slow, unreliable)
Next, you should break the transactions up into chunks of < 10,000 lines per chunk.
You might also want to place an Application.DoEvents between chunks.

The Garbage collection subsystem any many other subsystems need a few cycles every now and then to do their job. IOW, make your loop play nice with the OS and Network.

// Jerry

JerryShaw 46 Posting Pro in Training

If you need ID values from the database, then you should stick with using the database. Values in a database can change especially if the database is accessed from multiple computers.
The drawbacks of using a file system are:
It requires Disk IO which can be slower than an SQL connection (when pulling large amounts of data).
It can be a security risk.
Can get out of synch with the "source of truth".
Can become corrupted.
File sharing issues.

//JMO - Jerry

JerryShaw 46 Posting Pro in Training

Hopefully you adjusted the connection string to use your own server, and not mine ?

Did you walk it through the debugger and see what is happening ?

If you still can not get it to work, send me your project and csv file, and I will see what is wrong with it.

My email is shawhj@meadowcrk.com


// Jerry

JerryShaw 46 Posting Pro in Training

Here is a simplified way of doing it.
Typically, If using a database, I would avoid using the category class all together
but that is not what you were asking for.

Anyway, All this form has is a TreeView component and an untyped dataset. The onLoad takes off and loads a
dataset from code (just to avoid having to create a table, and all that connection stuff).
Then I load the List<Category> with the data.
Finally build the tree using a recursive method named getChildren.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace treeTest
{
    public partial class Form1 : Form
    {
        private List<Category> items = new List<Category>();
        public Form1()
        {
            InitializeComponent();
        }
        /*
         * dataSet1 has a table with 3 columns
         * col#1=ID (int)
         * col#2=ParentID (int)
         * col#3=NodeText (string)
         */ 
        private void Form1_Load(object sender, EventArgs e)
        {
            // Load up a dataset with values - usually from a database, but
            // here I can show the data without using a real database.
            dataSet1.Tables[0].Rows.Add(1, 0, "First Node");
            dataSet1.Tables[0].Rows.Add(3, 1, "Node 3.1");
            dataSet1.Tables[0].Rows.Add(4, 1, "Node 4.1");
            dataSet1.Tables[0].Rows.Add(5, 0, "Node 5.0");
            dataSet1.Tables[0].Rows.Add(6, 5, "Node 6.5");
            dataSet1.Tables[0].Rows.Add(7, 5, "Node 7.5");
            dataSet1.Tables[0].Rows.Add(8, 5, "Node 8.5");
            dataSet1.Tables[0].Rows.Add(9, 5, "Node 9.5");
            dataSet1.Tables[0].Rows.Add(10, 6, "Node 10.6");
            dataSet1.Tables[0].Rows.Add(11, 6, "Node 11.6");
            dataSet1.Tables[0].Rows.Add(12, 11, "Node 12.11");
            dataSet1.Tables[0].Rows.Add(13, 11, "Node 13.11");
            dataSet1.Tables[0].Rows.Add(14, 11, "Node 14.11");
            dataSet1.Tables[0].Rows.Add(15, 11, "Node 15.11");

            // Populate the items array of Catagory from the dataset
            foreach(DataRow dr in dataSet1.Tables[0].Rows)
                items.Add( new …
majestic0110 commented: Great work as always.Am linking to this in another thread! +2
JerryShaw 46 Posting Pro in Training

Doesn't close because the while statement runs out of reads, and drops into the dr & lgnconnection close...
It does not make sense to have both the true and false of a conditional result in the same statement "Close()". Why compare at all if the result is always going to be the same ?
Maybe you really mean to set the DialogResult to Ok or Cancel instead of just a close statemenet...

// Jerry

JerryShaw 46 Posting Pro in Training

AYK - Microsoft recommends not using the registry, and some client environments are locked down so that access to the registry can be fraught with problems.
The Property.settings does not use the registry. It reads from the config (XML) file, and writes a user config file in the local settings dir...well somewhere in the user's local settings path.

// Jerry

JerryShaw 46 Posting Pro in Training

"The only thing you can do is to inspect the line for commas, and replace them with a special character, then split, then find the special character and change it back into a comma."

After some thought, this statement probably won't work. If your CSV has the text columns wrapped in double quotes, then you can probably scrub the data to account for extra embedded commas but, if not... well you are kind-a screwed.

// Jerry

JerryShaw 46 Posting Pro in Training

Another idea that so many folks forget it there is the Property.Settings capability in VS.
See the Settings.settings item in your project (Solution Explorer).
It is actually an XML file that can be deployed with the application. Its advantage is that you do not need to write your own configuration file parsing routines.
When you use the data designer, it places the database connection string in the settings file.

In my own applications, I store many other things in there. You can place an item such as HasBeenSetup, and when the application first starts up on the client machine, check this setting, provide setup functionality such as asking for the name of the SQL Server), and set this HasBeenSetup setting to know they have the application setup.

Just a thought,
Jerry

JerryShaw 46 Posting Pro in Training

Here is a version of your code that was slightly modified, and works on a table with a few thousand rows.

The problem with the ""Input array is longer than the number of columns in this table." error is that the file has a column with an embedded comma. This causes the split to return additional columns.
This is a very typical problem with using CSV files. There is no way of knowing where the embedded comma is part of data, or used as a delimiter.
The only thing you can do is to inspect the line for commas, and replace them with a special character, then split, then find the special character and change it back into a comma.

private void button3_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(@"Data Source=SHAWHP\SQLEXPRESS;Initial Catalog=FOO;Persist Security Info=True;User ID=sa");
            string filepath = "C:\\params.csv";
            StreamReader sr = new StreamReader(filepath);
            string line = sr.ReadLine();
            string[] value = line.Split(',');
            DataTable dt = new DataTable();
            DataRow row;
            foreach (string dc in value)
            {
                dt.Columns.Add(new DataColumn(dc));
            }

            while ( !sr.EndOfStream )
            {
                value = sr.ReadLine().Split(',');
                if(value.Length == dt.Columns.Count)
                {
                    row = dt.NewRow();
                    row.ItemArray = value;
                    dt.Rows.Add(row);
                }
            }
            SqlBulkCopy bc = new SqlBulkCopy(con.ConnectionString, SqlBulkCopyOptions.TableLock);
            bc.DestinationTableName = "tblparam_test";
            bc.BatchSize = dt.Rows.Count;
            con.Open();
            bc.WriteToServer(dt);
            bc.Close();
            con.Close(); 
        }

// Jerry
PS If solved, please mark this topic as solved

JerryShaw 46 Posting Pro in Training

There are a number of ways to do this.
Using directing insert statement is one, another is using a stored procedure, calling as ssis package is another.

The easiest is probably the insert statement.
Simple get you SqlConnection, then use an SqlCommand.

use the string.Format method to parse the data into the command.

string Sql = string.Format("insert into foo(field1,field2) values('{0}',{1})",csv_value1,csv_value2);
SqlConnection conn = new SqlConnection(conectionstring)
conn.Open()
... Loop through all lines parsing the file into vars or an array
SqlCommand cmd = new SqlCommand(sql,conn)

cmd.ExecuteNonQuery();
... loop back
... finally close the connection, done

// Jerry

JerryShaw 46 Posting Pro in Training

Ok, to make this work more efficiently, I added another constructor to your Fraction class:
Just allows me to pass it a string. You can move the parsing up into FractionMatrix if you have to.

public Fraction(string value)
        {
            string[] nd = value.Split('/');
            SetFraction(Int32.Parse(nd[0]), Int32.Parse(nd[1]));
        }

Next, I modified your FractionMatrix.SetValues method to this:

public void SetValues(string  value)        
        {
            string[] elements = value.Replace("[", string.Empty).Replace("]", string.Empty).Trim().Split(';');
            string[] fSet;

            for (int i = 0; i < 3; i++)            
            {
                fSet = elements[i].Trim().Split(' ');
                for (int j = 0; j < 3; j++)                
                {
                    arr[i, j] = new Fraction(fSet[j]);
                }            
            }        
        }

Above you will see that I condition the incoming data into a 3 element string array.
This gets split into the 3 individual fraction strings. Finally each of those strings are passed to the Fraction constructor.

And Finally, I modified your FractionMatrix.ToString() override method to this:

public override string ToString()        
        {
            string result = "[";
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    result += " " + arr[i, j].ToString() + " ";
                }
                if(i<2)
                    result += ";";
            }
            result += "]";

            return result;
        }

I can pass in the string, watch the debuger move the data aound, and finally have the ToString() pass the data back out, and it comes out just like it was sent in (round trip confirms the data munging was done correctly).

Have Fun,
Jerry

JerryShaw 46 Posting Pro in Training

Where is your Fraction Class ?

JerryShaw 46 Posting Pro in Training

Hello Aminit,

Just a thought... have you considered using a binary value to represent each group ?
Set the Tag value for each checkbox with a hex value. Have a method OR the hex values for each checkbox (method will iterate through all checkboxes in a group) resulting in a single value for each group.

Hint: if you have each checkbox group contained in a panel or groupbox it makes it easier to iterate all checkboxes in that container rather than filter on all checkboxes on the form.


Once you have a single binary value for each checkbox group. You can (AND) the value with the other group(s) to see which combinations are checked as a single value.

If you have some known conditions (like that one which creates an error message), then you can AND that condition (as a binary value) to the checkbox group binary values.

Its just a matter of math.

If this sounds confusing, consider it this way. If you can represent Group A as a single value, then you can use simple boolean operators to compare against specific conditions you want to check.


// Jerry

JerryShaw 46 Posting Pro in Training

It sounds like you need to venture into the Regular Exressions class.

JerryShaw 46 Posting Pro in Training

If the matrix values are contained inside of a string, then just create a method that receives a string.

private void foo(string value)
{
// parse the value into its parts.
}


// Jerry

JerryShaw 46 Posting Pro in Training

Option #1

private void button2_Click(object sender, EventArgs e)
        {
            string sLine = "";
            DateTime dates;
            DateTime start = Convert.ToDateTime("03/01/2008 00:00:00");
            DateTime end = Convert.ToDateTime("03/09/2008 00:00:00");
            StreamReader sr = new StreamReader(@"C:\cvsParse.txt");
            StreamWriter sw = new StreamWriter(@"C:\dates.txt");

            sw.WriteLine( sr.ReadLine() );
            while (!sr.EndOfStream)
            {
                sLine = sr.ReadLine();
                dates = Convert.ToDateTime(sLine.Replace("\"",string.Empty).Split(',')[0]);
                if (dates >= start && dates < end)
                    sw.WriteLine(sLine);
            }
            sr.Close();
            sw.Flush();
            sw.Close();

        }

Option #2

private void button1_Click(object sender, EventArgs e)
        {
            string header = "";
            string dates = "";
            string[] dvalue = null;

            StreamReader sr = new StreamReader(@"C:\cvsParse.txt");
            StreamWriter sw = new StreamWriter(@"C:\dates.txt");

            DataTable dt = new DataTable("cvs");
            dt.Columns.Add("start_date_time", typeof(DateTime));
            dt.Columns.Add("origin");
            header = sr.ReadLine();
            while (!sr.EndOfStream)
            {
                dates = sr.ReadLine();
                dvalue = dates.Split(',');
                dt.Rows.Add(Convert.ToDateTime(dvalue[0].Replace("\"", string.Empty))  , dates );
            }
            sr.Close();

            DataRow[] dr = dt.Select("start_date_time > '03/01/2008 00:00:01' and start_date_time < '03/01/2008 00:30:59'");
            sw.WriteLine(header);
            foreach (DataRow row in dr)
                sw.WriteLine(row["origin"].ToString());

            sw.Flush();
            sw.Close();

        }

Both examples create a new file with only the desired dates.

Option #1 simply copys the file into a new file where the date is in the desired range .
Option #2 is a little fancier, where it uses a DataTable to get the data, and allows you to write it out at one time. The datatable approach opens the door to all kinds of filtering, sorting, write out as XML, whatever you can do with a data table.

// Jerry

JerryShaw 46 Posting Pro in Training

This sounds like the normal behaviour of a bound dataset. When multiple controls use the same bindingsource (Navigators, Grid, Combo, Listbox, etc), any component that causes the bindingsource.Position to change effects all components bound to the same bindingsource.

Either use two bindingsources (one for the grid and its navigator), the other for the combobox, or like Ramy said, use a different table in the dataset. Its not unclean code either way, its just a mater of using the correct binding.

I personally refrain from using the data designer for reasons like this. I build my own Data Access Layer (DAL) class that does the same thing, but with the finite control I desire.

// Jerry

JerryShaw 46 Posting Pro in Training

Okay, I just took care of your problem. Sent you an email with the details.
I believe you can mark this as solved.

Jerry

JerryShaw 46 Posting Pro in Training

Jens,

If you are able to find a method other than using a byte[] and memorystream to push large data (such as a file) into an SQL column, please let me know.

From what I understand, when using a stream class you are serializing data. Keep in mind that when you are pushing a file into a data column, you are using the mechanisms of the SQL Dlls as wrapped in the System.Data and System.data.SqlClient libraries.

In my project, I am serializing a multi-table dataset as XML into a SQL column. This allows me to capture large amounts of data from multiple sources (and types) for transport through an SQL database. I still have to use byte[] and stream to run the data into and outof the blob field. I do have a second column (varchar(max)) for handling smaller objects such as a generic collection class that has special metedata and some attributes seperate from the XML dataset that can be stored directly to the Sql column. It is a serializable class, so it converts easily. But the varchar column only allows char type but serialization moves data as XML anyway, so that is not a problem.

When posting PDF, Images, and other binary data, I use byte[] and stream into the blob field.

Let me know what you find.
Jerry

JerryShaw 46 Posting Pro in Training

Ramon,

Tell ya what I will offer. Send me a backup of your database (zip'ed) along with your project source code, and I will test it here. Either I will be successful, meaning that your Server is at fault, or I will discover the problem in your source, and tell you what needs to be fixed.
If you don't want to post your database here, then you can send it to Shawjh@meadowcrk.com or post it somewhere so I can download it.

Regards,
Jerry

JerryShaw 46 Posting Pro in Training

Do you have access to that database through the SQL management studio ?

JerryShaw 46 Posting Pro in Training

I have adjusted the connection string to your criteria (below).
Make sure that your Sql server is alive. You should (in task manager process) have the following processes running: (as a minium)
sqlserver.exe
sqlwriter.exe
sqlbrowser.exe
If not, then go to windows services, and set the SqlServer.exe to run, it should cause the others to fire up.
You should also have the Sql Server Management program installed. This will allow you to confirm the server is runing, create tables, etc. If it can connect to the server, then the connection string is the issue.

SqlConnection conn = new SqlConnection("Data Source=vista-sp1;Initial Catalog=Dorpshuis;Integrated Security=SSPI);