Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   C# datatable not reading from proc! (http://www.go4expert.com/forums/c-sharp-datatable-reading-proc-t27175/)

lemunk 18Nov2011 13:47

C# datatable not reading from proc!
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!

All times are GMT +5.5. The time now is 05:25.