11 Replies - 5162 Views - Last Post: 22 October 2014 - 03:53 PM Rate Topic: -----

#1 ckelley   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-October 14

SQLException: Error converting data type varchar to numeric.

Posted 22 October 2014 - 11:44 AM

Hi Everyone,

I am writing a simple program to suck in a txt file then pump it into sql.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data.OleDb;
using System.Data.SqlClient;



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

        private void Form1_Load(object sender, EventArgs e)
        {
            listView1.View = View.Details;
            listView1.GridLines = true;
            listView1.FullRowSelect = true;

            listView1.Columns.Add("EMP_KEY", 80);
            listView1.Columns.Add("DEBTOR_KEY", 90);
            listView1.Columns.Add("EMP_NAME", 200);
            listView1.Columns.Add("INDUSTRY", 100);
            listView1.Columns.Add("LNAME", 100);
            listView1.Columns.Add("FNAME", 100);
            listView1.Columns.Add("MI", 30);
            listView1.Columns.Add("ADD1", 150);
            listView1.Columns.Add("ADD2", 150);
            listView1.Columns.Add("CITY", 100);
            listView1.Columns.Add("STATE", 50);
            listView1.Columns.Add("ZIP", 60);
            listView1.Columns.Add("PHONE1", 100);
            listView1.Columns.Add("EXT1", 50);
            listView1.Columns.Add("PHONE2", 100);
            listView1.Columns.Add("EXT2", 50);
            listView1.Columns.Add("FAX", 100);
            listView1.Columns.Add("EMAIL", 100);
            listView1.Columns.Add("OCCUPATION", 100);
            listView1.Columns.Add("JOB_TITLE", 100);
            listView1.Columns.Add("HIRE_DATE", 100);
            listView1.Columns.Add("TERM_DATE", 100);
            listView1.Columns.Add("FREQ", 70);
            listView1.Columns.Add("WAGE", 70);
            listView1.Columns.Add("FT_FLAG", 70);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog Ofd = new OpenFileDialog();

            try
            {
                Ofd.CheckFileExists = true;
                Ofd.CheckPathExists = true;
                Ofd.DefaultExt = "txt";
                Ofd.DereferenceLinks = true;
                Ofd.Filter = "Text files (*.txt)|*.txt|" +
                    "RTF files (*.rtf)|*.rtf|" + " + Works 6 and 7 (*.wps)|*.wps|" + "Windows Write (*.wri)|*.wri|" +
                    "WordPerfect document (*.wpd)|*.wpd";
                Ofd.Multiselect = false;
                Ofd.RestoreDirectory = true;
                Ofd.ShowHelp = true;
                Ofd.ShowReadOnly = false;
                Ofd.Title = "Select a file ";
                Ofd.ValidateNames = true;

                if (Ofd.ShowDialog() == DialogResult.OK)
                {
                    string line = "";
                    string[] items;
                    ListViewItem listItem;
                    string fileToOpen = Ofd.FileName;
                    StreamReader reader = new StreamReader(fileToOpen);
                    while ((line = reader.ReadLine()) != null)
                    {
                        items = line.Split('\t');
                        listItem = new ListViewItem();
                        for (int i = 0; i < items.Length; i++)
                        {
                            if (i == 0)
                            {
                                listItem.Text = items[i];
                            }
                            else
                            {

                                listItem.SubItems.Add(items[i]);

                            }

                        }
                        listView1.Items.Add(listItem);
                    }
                }
            }
            catch
            {
                MessageBox.Show("Can not open the file", "Employer Import Utility");
            }
        }

        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            
            SqlConnection conn = new SqlConnection();
            conn.ConnectionString =
                "Data Source = [server];" +
                "Initial Catalog = [tbl];" +
                "User id = [username];" +
                "Password = [password];";
                conn.Open();

            foreach (ListViewItem li in listView1.Items)
            {
                SqlCommand cmd = new SqlCommand("insert into employer (EMP_KEY,DEBTOR_KEY,EMP_NAME,INDUSTRY,LNAME,FNAME,MI,ADD1,ADD2,CITY,STATE,ZIP,PHONE1,EXT1,PHONE2,EXT2,FAX,EMAIL,OCCUPATION,JOB_TITLE,HIRE_DATE,TERM_DATE,FREQ,WAGE,FT_FLAG)values('" + li.SubItems[0].Text + "','" + li.SubItems[1].Text + "','" + li.SubItems[2].Text + "','" + li.SubItems[3].Text + "','" + li.SubItems[4].Text + "','" + li.SubItems[5].Text + "','" + li.SubItems[6].Text + "','" + li.SubItems[7].Text + "','" + li.SubItems[8].Text + "','" + li.SubItems[9].Text + "','" + li.SubItems[10].Text + "','" + li.SubItems[11].Text + "','" + li.SubItems[12].Text + "','" + li.SubItems[13].Text + "','" + li.SubItems[14].Text + "','" + li.SubItems[15].Text + "','" + li.SubItems[16].Text + "','" + li.SubItems[17].Text + "','" + li.SubItems[18].Text + "','" + li.SubItems[19].Text + "','" + li.SubItems[20].Text + "','" + li.SubItems[21].Text + "','" + li.SubItems[22].Text + "','" + li.SubItems[23].Text + "','" + li.SubItems[24].Text + "')",conn);
                    cmd.ExecuteNonQuery();
            }
            conn.Close();
        }
    }
}



everything works okay, except for the sql insert. I tried to convert the values to what the db needs, but I am coming up short.

// SqlCommand cmd = new SqlCommand("insert into employer (EMP_KEY,DEBTOR_KEY,EMP_NAME,INDUSTRY,LNAME,FNAME,MI,ADD1,ADD2,CITY,STATE,ZIP,PHONE1,EXT1,PHONE2,EXT2,FAX,EMAIL,OCCUPATION,JOB_TITLE,HIRE_DATE,TERM_DATE,FREQ,WAGE,FT_FLAG)values('" + [b]Int32.Parse(li.SubItems[0].Text)[/b] + "','" + [b]Int32.Parse(li.SubItems[1].Text) [/b]+ "','" + li.SubItems[2].Text + "','" + li.SubItems[3].Text + "','" + li.SubItems[4].Text + "','" + li.SubItems[5].Text + "','" + li.SubItems[6].Text + "','" + li.SubItems[7].Text + "','" + li.SubItems[8].Text + "','" + li.SubItems[9].Text + "','" + li.SubItems[10].Text + "','" + li.SubItems[11].Text + "','" + li.SubItems[12].Text + "','" + li.SubItems[13].Text + "','" + li.SubItems[14].Text + "','" + li.SubItems[15].Text + "','" + li.SubItems[16].Text + "','" + li.SubItems[17].Text + "','" + li.SubItems[18].Text + "','" + li.SubItems[19].Text + "','" + [b]DateTime.Parse(li.SubItems[20].Text)[/b] + "','" + DateTime.Parse(li.SubItems[21].Text) + "','" + li.SubItems[22].Text + "','" + [b]Int32.Parse(li.SubItems[23].Text)[/b] + "','" + li.SubItems[24].Text + "')", conn);




Can someone point me or provide an example of how I can get past this error and get the data into sql? I read a couple articles on .tag but not sure I understand what to do.

Is This A Good Question/Topic? 0
  • +

Replies To: SQLException: Error converting data type varchar to numeric.

#2 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6829
  • View blog
  • Posts: 28,311
  • Joined: 12-December 12

Re: SQLException: Error converting data type varchar to numeric.

Posted 22 October 2014 - 11:55 AM

You should use SQL Parameters then most of the conversion issues will disappear, and your code will be more secure.

This snippet is in VB.NET but it demonstrates the essentials of the process, and contains a link for further information.

I've just run my snippet through this converter to get C# code:
private void btnGo_Click(object sender, EventArgs e)
{
	string sConn = "Data Source=.\\SQLExpress;Initial Catalog=northwind;Integrated Security=True";

	string sSql = "SELECT * FROM Orders WHERE ShipCountry = @Country AND OrderDate > @OrderDate";

	SqlConnection conn = new SqlConnection(sConn);
	SqlCommand cmd = new SqlCommand(sSql, conn);

	//could configure parameters individually:
	cmd.Parameters.Add("@Country", SqlDbType.NVarChar);
	cmd.Parameters("@Country").Value = txtCountry.Text;

	//easier to add in one go, and let the database deal with the data-type:
	cmd.Parameters.AddWithValue("@OrderDate", dtpOrderDate.Value);

	SqlDataAdapter adapter = new SqlDataAdapter(cmd);
	DataSet ds = new DataSet();
	adapter.Fill(ds, "OrdersTable");

	dgvData.DataSource = ds;
	dgvData.DataMember = "OrdersTable";
}

This post has been edited by andrewsw: 22 October 2014 - 11:58 AM

Was This Post Helpful? 1
  • +
  • -

#3 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6829
  • View blog
  • Posts: 28,311
  • Joined: 12-December 12

Re: SQLException: Error converting data type varchar to numeric.

Posted 22 October 2014 - 12:04 PM

Continuing with your current approach, you will first have to deduce which field, or fields, are causing the problem. Do the error details provide any clues?

It is most likely the date fields. Values for these need to be provided in a format that is acceptable to the database.

If you aren't sure which fields are an issue then you should reduce the number of fields inserted, and keep testing until you track them down.
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6536
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: SQLException: Error converting data type varchar to numeric.

Posted 22 October 2014 - 12:04 PM

See FAQ 32 at the end for a comprehensive set of links for database tutorials.



Looking at your code you have some bad practices in play that need your immediate attention.
These will form bad habits quickly and should be worked on. This is part of what I mean by "learn foundation concepts first".

Problem 1: Use of GUI controls as your variables.
You have numerous places where you are doing things like: SomeMethodCall(TextBox43.Text);
Your textboxes and other GUI elements are not meant to be your variables to hold values. They exist only to be a way for the user to interact with the data held in the logic code *behind* the GUI. You should have properties bound to the GUI. When the user changes something in a textbox it updates the property in your code. When the property gets a new value, the GUI is updated. But your logic always uses the property not the GUI element.
There is a tutorial on properties linked in my signature block.

Problem 2: This bit about button1 and textbox14 is just horrible. If you are working in old 1980's WinForms for Win98 and WinXP programs then name your control as soon as you make it before doing anything else with it. txtbxFirstName is so much easier to maintain than textbox32. Same with "frmConnectionSettings" instead of "form2" or "wndCustomerDetails" than "window4". If you are making programs for current OSes like Win7/8 then you should be working in WPF where the controls don't need to be named 90% of the time, but the same practice of giving meaningful names should still be followed in the few cases where they are needed.

Problem 3: Don't put meaningful operational code in GUI control handlers. You have a lot of places where the work is being done in the button event handler instead if in a dedicated method. Instead you want that handler to just direct action to the first methods, not actually perform the actions.
btnSave_Click(object sender, eventargs e)
{
   SaveSettings(); // Call the save method
   SavePlayers();
   SaveWindowGeometry();
   // Do NOT put all the save code here
}

This way you can call the same save methods independently form code without having to either duplicate code (evil practice) or without calling the button handler. If you are using WinForms then you have a .Click event handler. If you are writting in WPF then don't call the .Click event but instead create Commands and activate those. The .Click handler in WPF is kind of a carry-over to give WinForms coders a comfortable migration path but is not considered the way a modern profession WPF coder works.

Problem 4:
Eye sore code.
Take the extra 2 minutes to clean up your code to make it easy to read, easy to follow, and most important, easy to manage.
  • Kill all those dead blank lines at the ends of methods.
  • Wrap groups of methods that go together in #region blocks so you can find all your sending code and receiving code easily for example.
  • Get your lines aligned. Control-K, Control-D will do that for you (Think of it as Klean Document)


Problem 5: Decent naming
Methods like private void ClientSession(object sender, eventargs e); don't follow established naming style guides.
A method performs an action. By convention for decades methods are named as verbs to show what they do. Nouns like ClientSession would be presumed to be a property by any other coder looking at your code. private void CreateClientSession(object sender, eventargs e); on the other hand shows that it does something (a method) not that it is something (a variable).

I'm not going to go into a long critique of your code. And I don't want you to feel like I'm just out to pick on you. I'm just pointing out a couple of many foundation concepts you didn't pickup up in the early stages of learning C#. You can't leap-frog the learning process by trying to build a program in your first month. Nobody can. Its not just you. Nobody in the first month of a new discipline has enough knowledge to jump in and start designing finished solutions: Not carpentry, not automotive design, not software engineering. C# is a foreign language with its own syntax. You aren't going to say "I know no Russian. I'm going to write a Russian mystery novel as my vehicle to learn the language." Same here with programming.

I urge you to take a step back. Pick up a "Learn C# in 30 days" type book and work your way through it cover to cover; don't use it a like a reference dictionary when you get stuck. There are several in a thread pinned to head of the C# forum. Plus there are countless C# beginner tutorial series around just like the C# Learning Series - tutorials here on DIC. There are also numerous "My First C# Program" tutorials like this one that will help you with the design and OOP concepts that are vital to good programming.



TOP most asked:
What does this error message mean?
FAQ 2: How do I debug
FAQ 6: How do I make Class1/Form1 talk to Class2/Form2


FAQ (Frequently Asked Questions - Updated July 2014
Spoiler

This post has been edited by tlhIn`toq: 22 October 2014 - 12:08 PM

Was This Post Helpful? 0
  • +
  • -

#5 Curtis Rutland   User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 5106
  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: SQLException: Error converting data type varchar to numeric.

Posted 22 October 2014 - 12:08 PM

There's a link in my signature about using parameterized queries. I highly suggest you read through it. It's not just about protecting against SQL injection; parameterized queries are much easier to read and use.

However! There's another option as well: an ORM like Entity Framework. It's a bit heavy-weight for this sort of thing, but it will make this insert statement a lot more trivial.

An ORM like Entity Framework will connect to your database, download the schema of the selected tables/views/stored procedures, then generate classes for you that have properties that match the table's columns. Strings for varchars, ints for ints, bools for bits, etc...

To do an insert, all you have to do is make a new instance of the generated class, and pass it into a data context. The context will handle generating the SQL to send to the server all by itself.

If you're interested, look up some Entity Framework tutorials. Other options are LINQ to SQL (not being actively developed), NHibernate (which is good but not a Microsoft first party tool), and others like it.
Was This Post Helpful? 0
  • +
  • -

#6 ckelley   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-October 14

Re: SQLException: Error converting data type varchar to numeric.

Posted 22 October 2014 - 12:29 PM

wow guys...Thanks for all the replies, I appreciate it. I have only been coding for about three months, and during that time I have been tasked with all t-sql stuff, so this is my first go at oop. I was hoping to learn trial-by-fire, drinking from the fire hose not sipping from a cup type of thing.

I will work on getting my code up to snuff, and review parameters.

Jr Hat snugly on.
Was This Post Helpful? 0
  • +
  • -

#7 ckelley   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-October 14

Re: SQLException: Error converting data type varchar to numeric.

Posted 22 October 2014 - 12:39 PM

View PostCurtis Rutland, on 22 October 2014 - 12:08 PM, said:

There's a link in my signature about using parameterized queries. I highly suggest you read through it. It's not just about protecting against SQL injection; parameterized queries are much easier to read and use.

However! There's another option as well: an ORM like Entity Framework. It's a bit heavy-weight for this sort of thing, but it will make this insert statement a lot more trivial.

An ORM like Entity Framework will connect to your database, download the schema of the selected tables/views/stored procedures, then generate classes for you that have properties that match the table's columns. Strings for varchars, ints for ints, bools for bits, etc...

To do an insert, all you have to do is make a new instance of the generated class, and pass it into a data context. The context will handle generating the SQL to send to the server all by itself.

If you're interested, look up some Entity Framework tutorials. Other options are LINQ to SQL (not being actively developed), NHibernate (which is good but not a Microsoft first party tool), and others like it.


awesome write up
http://www.dreaminco...ery-a-database/
Was This Post Helpful? 0
  • +
  • -

#8 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6536
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: SQLException: Error converting data type varchar to numeric.

Posted 22 October 2014 - 12:50 PM

View Postckelley, on 22 October 2014 - 01:29 PM, said:

so this is my first go at oop.


Oh crap. Are you in school, or did you bluff your way into a job? "tasked" sounds like it could be either.

There is a tutorial linked in my signature block on objects/classes that might help you out with the OOP thing.

Also this tutorial is very OOP oriented, even though it is one of my older ones in 1980's WinForms instead of modern WPF.
http://www.dreaminco...ister-part-one/
Was This Post Helpful? 0
  • +
  • -

#9 ckelley   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-October 14

Re: SQLException: Error converting data type varchar to numeric.

Posted 22 October 2014 - 01:14 PM

Customer service to tech support to t2 to jr, lol no school....I will watch the videos.

got this so far, about to step into and see what happens
 foreach (ListViewItem li in listView1.Items)
            {
                string cmdstr = "INSERT INTO EMPLOYER (EMP_KEY,DEBTOR_KEY,EMP_NAME,INDUSTRY,LNAME,FNAME,MI,ADD1,ADD2,CITY,STATE,ZIP,PHONE1,EXT1,PHONE2,EXT2,FAX,EMAIL,OCCUPATION,JOB_TITLE,HIRE_DATE,TERM_DATE,FREQ,WAGE,FT_FLAG) VALUES (@EMP_KEY,@DEBTOR_KEY,@EMP_NAME,@INDUSTRY,@LNAME,@FNAME,@MI,@ADD1,@ADD2,@CITY,@STATE,@ZIP,@PHONE1,@EXT1,@PHONE2,@EXT2,@FAX,@EMAIL,@OCCUPATION,@JOB_TITLE,@HIRE_DATE,@TERM_DATE,@FREQ,@WAGE,@FT_FLAG)";
                using (SqlCommand command = new SqlCommand(cmdstr,conn)){
                    command.Parameters.Add("@EMP_KEY", SqlDbType.Int);
                    command.Parameters["@EMP_KEY"].Value = li.SubItems[0].Text;
                    command.Parameters.Add("@DEBTOR_KEY", SqlDbType.Int);
                    command.Parameters["@DEBTOR_KEY"].Value = li.SubItems[1].Text;
                    command.Parameters.Add("@EMP_NAME", SqlDbType.Char);
                    command.Parameters["@EMP_NAME"].Value = li.SubItems[2].Text;
                    command.Parameters.Add("@INDUSTRY", SqlDbType.Char);
                    command.Parameters["@INDUSTRY"].Value = li.SubItems[3].Text;
                    command.Parameters.Add("@LNAME", SqlDbType.Char);
                    command.Parameters["@LNAME"].Value = li.SubItems[4].Text;
                    command.Parameters.Add("@FNAME", SqlDbType.Char);
                    command.Parameters["@FNAME"].Value = li.SubItems[5].Text;
                    command.Parameters.Add("@MI", SqlDbType.Char);
                    command.Parameters["@MI"].Value = li.SubItems[6].Text;
                    command.Parameters.Add("@ADD1", SqlDbType.Char);
                    command.Parameters["@ADD1"].Value = li.SubItems[7].Text;
                    command.Parameters.Add("@ADD2", SqlDbType.Char);
                    command.Parameters["@ADD2"].Value = li.SubItems[8].Text;
                    command.Parameters.Add("@CITY", SqlDbType.Char);
                    command.Parameters["@CITY"].Value = li.SubItems[9].Text;
                    command.Parameters.Add("@STATE", SqlDbType.Char);
                    command.Parameters["@STATE"].Value = li.SubItems[10].Text;
                    command.Parameters.Add("@ZIP", SqlDbType.Char);
                    command.Parameters["@ZIP"].Value = li.SubItems[11].Text;
                    command.Parameters.Add("@PHONE", SqlDbType.Char);
                    command.Parameters["@PHONE"].Value = li.SubItems[12].Text;
                    command.Parameters.Add("@EXT1", SqlDbType.Char);
                    command.Parameters["@EXT1"].Value = li.SubItems[13].Text;
                    command.Parameters.Add("@PHONE2", SqlDbType.Char);
                    command.Parameters["@PHONE2"].Value = li.SubItems[14].Text;
                    command.Parameters.Add("@EXT2", SqlDbType.Char);
                    command.Parameters["@EXT2"].Value = li.SubItems[15].Text;
                    command.Parameters.Add("@FAX", SqlDbType.Char);
                    command.Parameters["@FAX"].Value = li.SubItems[16].Text;
                    command.Parameters.Add("@EMAIL", SqlDbType.Char);
                    command.Parameters["@EMAIL"].Value = li.SubItems[17].Text;
                    command.Parameters.Add("@OCCUPATION", SqlDbType.Char);
                    command.Parameters["@OCCUPATION"].Value = li.SubItems[18].Text;
                    
                    command.Parameters.Add("@JOB_TITLE", SqlDbType.Char);
                    command.Parameters["@JOB_TITLE"].Value = li.SubItems[19].Text;
                    
                    command.Parameters.Add("@HIRE_DATE", SqlDbType.DateTime);
                    command.Parameters["@HIRE_DATE"].Value = li.SubItems[20].Text;
                    command.Parameters.Add("@TERM_DATE", SqlDbType.DateTime);
                    command.Parameters["@TERM_DATE"].Value = li.SubItems[21].Text;
                    command.Parameters.Add("@FREQ", SqlDbType.Char);
                    command.Parameters["@FREQ"].Value = li.SubItems[22].Text;
                    command.Parameters.Add("@WAGE", SqlDbType.Int);
                    command.Parameters["@WAGE"].Value = li.SubItems[23].Text;
                    command.Parameters.Add("@FT_FLAG", SqlDbType.Bit);
                    command.Parameters["@FT_KEY"].Value = li.SubItems[24].Text;

                        conn.Open();


Was This Post Helpful? 0
  • +
  • -

#10 Curtis Rutland   User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 5106
  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: SQLException: Error converting data type varchar to numeric.

Posted 22 October 2014 - 01:23 PM

In my writeup, I show how to use AddWithValue, which is much simpler than having to set a data type on each parameter. AddWithValue infers the type of the parameter with the type of the data provided.
Was This Post Helpful? 1
  • +
  • -

#11 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6829
  • View blog
  • Posts: 28,311
  • Joined: 12-December 12

Re: SQLException: Error converting data type varchar to numeric.

Posted 22 October 2014 - 01:31 PM

View PostCurtis Rutland, on 22 October 2014 - 08:23 PM, said:

In my writeup, I show how to use AddWithValue, which is much simpler than having to set a data type on each parameter. AddWithValue infers the type of the parameter with the type of the data provided.

My snippet emphasizes this as well ;)
Was This Post Helpful? 0
  • +
  • -

#12 ckelley   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-October 14

Re: SQLException: Error converting data type varchar to numeric.

Posted 22 October 2014 - 03:53 PM

sorry guys, I changed it to use .AddWithValue, worked like a charm. It pumps the statements into sql, I had to change the EMP_KEY to pull the max() from the db and in the loop set it to add +1 for each iteration.

Tomorrow I have to figure out how to get the program to start over once the listview1.clear() happens...

Felt good to get that going, thanks everyone for your help and for giving me something I can use FOREVER I hope :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1