C# datatable not reading from proc!

Discussion in 'C#' started by lemunk, Nov 18, 2011.

  1. lemunk

    lemunk New Member

    Nov 18, 2011
    Likes Received:
    Trophy Points:
    Hi guys,

    Im writing a windows c# form at the moment and after all the headaches of gettin my stored procedure to combine 2 tables from 2 databases from 2 servers that had different collations(.....yeh MASSIVE headache)ive hit another snag!

    here's my form1 code, no where near completed, missing my try/catchs, methods etc.
    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.Data;
    using System.Data.Sql;
    using System.Data.SqlClient;
    namespace RepSalesNetAnalysis
        public partial class Form1 : Form
            public Form1()
            private void button1_Click(object sender, EventArgs e)
                string myConn = "Server=,1435;" +
                            "Database=shaftdata;" +
                            "uid=steve;" +
                            "pwd=steve1;" +
                            "Connect Timeout=300;";
                SqlConnection conn = new SqlConnection(myConn);
                SqlCommand Pareto = new SqlCommand();
                Pareto.Connection = conn;
                Pareto.CommandType = CommandType.StoredProcedure;
                Pareto.CommandText = "AAlinkParetoOK";
                BindingSource bindme = new BindingSource();
                DataTable mytable = new DataTable();
                SqlDataAdapter table1 = new SqlDataAdapter(Pareto);
                SqlDataReader read = Pareto.ExecuteReader();
                TESTER.Text = "ok it worked";
                //bindme.DataSource = table1;
                //dataGridView1.DataSource = bindme; 
    i seem to connect no problem, i seem to create my adapters no problem but when i call my stored procedure no data is put into my table(ignore my commented out lines, they are part of my debugging).
    ive double checked my sql proc and it does work. so there somthing about me calling it that doesnt.
    Any help would be excellent!

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice