Advertisement

12.27.2005 at 10:20AM PST, ID: 21676291
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Convert code from C# (Sharp).net 2005 to Visual Basic .net 2005

Asked by Jeb911 in Miscellaneous Programming

Tags: , , , ,

I need this code converted to visual studio 2005.... I am parsing some data in a database... All help will be appreciated and awarded to the one who can complete this task....

-JEB


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

namespace qatdata
{
    public partial class frmConvert : Form
    {
        public frmConvert()
        {
            InitializeComponent();

         
            // GetData();
        }
        private void GetData() {
            DataTable dt = new DataTable();
            OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\csharpprojects\qat\QAT_Products.mdb;User Id=admin;Password=;");
            OleDbCommand cmd = con.CreateCommand();
            cmd.CommandText = "Select * From ProductUpdate where title > '' Order by Category";
            OleDbDataAdapter da = new OleDbDataAdapter(cmd);
            da.Fill(dt);

            dt.Columns.Add("Cat",typeof(string));
            dt.Columns.Add("Cat2",typeof(string));
            dt.Columns.Add("Cat3", typeof(string));
            dt.Columns.Add("SubCatID", typeof(int));
            String[] aHolder;
            foreach (DataRow dr in dt.Rows)
            {
                aHolder = dr["Category"].ToString().Split(new string[] { @"///" },System.StringSplitOptions.None);
                if (aHolder.Length > 0)
                dr["Cat"] = aHolder[0];
                if( aHolder.Length >1)
                dr["Cat2"] = aHolder[1];
                if (aHolder.Length > 2)
                dr["Cat3"] = aHolder[2];
           
            }
            string InsertString,LastCat="x", LastSub="x";
            int Cat=0,SubCat=0;


            foreach (DataRow dr in dt.Rows) ///this routine could be added to the above loop.. but speed is not an issue here
            {
                if(LastCat!=dr["Cat"].ToString())//changing insert new id
                {    Cat++;//increment id
                     LastCat=dr["Cat"].ToString();
                     InsertString = string.Format("insert into Categories(CategoryID,ParentID,CategoryName)Values({0},{1},{2})",Cat,0,LastCat);
                     InsertID(InsertString);
                }
                if(LastSub!=dr["Cat2"].ToString())//changing insert new subid
                {   SubCat++;//increment id
                    LastSub=dr["Cat2"].ToString();
                    InsertString = string.Format("insert into Categories(CategoryID,ParentID,CategoryName)Values({0},{1},{2})",SubCat,Cat,LastSub);
                    InsertID(InsertString);
                }
               
                dr["SubCatID"] = SubCat;//< this is just for show inserting should be done on different table
                //add other columns as needed...
                InsertString = string.Format("insert into Products(CategoryIDs,ProductName)Values({0},{1})", SubCat,dr["Title"]);
                InsertProduct(InsertString);
            }


            this.dataGridView1.DataSource = dt;

           
         

       
        }
        private void InsertID(string p_InsertString)
        {
            //do insert here
         //example:
            OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\csharpprojects\qat\Categories.mdb;User Id=admin;Password=;");
            OleDbCommand cmd = con.CreateCommand();
            cmd.CommandText = p_InsertString;
            try
            {
                con.Open();
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally { con.Close(); }
            return;
        }
        private void InsertProduct(string p_InsertString)
        {
            //do insert here
            return;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            GetData();
        }

        private void frmConvert_Load(object sender, EventArgs e)
        {

        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }
    }
}Start Free Trial
[+][-]12.27.2005 at 12:36PM PST, ID: 15558084

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Miscellaneous Programming
Tags: code, convert, visual, 2005, sharp
Sign Up Now!
Solution Provided By: cookre
Participating Experts: 3
Solution Grade: A
 
 
[+][-]12.27.2005 at 02:22PM PST, ID: 15558779

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]12.28.2005 at 12:35AM PST, ID: 15561256

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]01.18.2006 at 04:35PM PST, ID: 15735049

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]01.23.2006 at 05:02AM PST, ID: 15765642

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]01.23.2006 at 05:21AM PST, ID: 15765934

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.23.2006 at 05:23AM PST, ID: 15765944

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.23.2006 at 05:24AM PST, ID: 15765955

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.23.2006 at 05:33AM PST, ID: 15765992

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]01.23.2006 at 05:39AM PST, ID: 15766062

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.23.2006 at 05:41AM PST, ID: 15766089

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]01.23.2006 at 05:45AM PST, ID: 15766159

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.23.2006 at 05:56AM PST, ID: 15766266

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44