Click here to Skip to main content
15,897,360 members
Home / Discussions / C#
   

C#

 
QuestionSend SMS /MMS to mobile phone from FTP server Pin
pearllyn6-Aug-09 15:46
pearllyn6-Aug-09 15:46 
AnswerRe: Send SMS /MMS to mobile phone from FTP server Pin
Spacix One6-Aug-09 17:28
Spacix One6-Aug-09 17:28 
AnswerRe: Send SMS /MMS to mobile phone from FTP server Pin
Blue_Boy7-Aug-09 3:41
Blue_Boy7-Aug-09 3:41 
QuestionSaving RSS feed in "utf-8" format. Pin
dbhalla_in6-Aug-09 14:29
dbhalla_in6-Aug-09 14:29 
AnswerRe: Saving RSS feed in "utf-8" format. Pin
Luc Pattyn6-Aug-09 14:45
sitebuilderLuc Pattyn6-Aug-09 14:45 
QuestionRelative URLs in Code-Behind Pin
Colin Pace6-Aug-09 10:52
Colin Pace6-Aug-09 10:52 
AnswerRe: Relative URLs in Code-Behind Pin
Adam R Harris6-Aug-09 11:07
Adam R Harris6-Aug-09 11:07 
QuestionC# Dataset bind to DataGridView update tabel in SQL Server 2005 DB Pin
Wheels0126-Aug-09 9:42
Wheels0126-Aug-09 9:42 
Good afternoon I am trying to populate a DataGridView, but for some reason when I click the Query button the grid remains blank. I know the query works. My code is as follows:

Form
private void btnQuery_Click(object sender, EventArgs e)
        {
            PwdSecurity p = new PwdSecurity();
            uipc = this.Parent as UIPCMainForm;
            const string constrallowedBlockTypes = "allowedBlockTypes";
            DAL d = new DAL(uipc.StrUserName, p.base64Decode(uipc.StrPassword));

            //Clear dgv if it needs it
            dgv.DataSource = null;
            dgv.Refresh();

            bs = new BindingSource();
            bs.DataSource = d.AllowedTypes(constrallowedBlockTypes);
            dgv.ScrollBars = ScrollBars.Both;
            dgv.DataSource = bs; 
        }

        private void btnUpdate_Click(object sender, EventArgs e)
        {
            dgv.Update();
            //dgv.Update(bs.DataSource);
        }


DAL
public DataSet AllowedTypes(string Type)
        {
            string SQL = String.Empty;
            ds = new DataSet();
            try
            {
                SqlCmd = new SqlCommand("spGET_ALLOWED_TYPE", myConnection);
                SqlCmd.CommandType = CommandType.StoredProcedure;

                SqlCmd.Parameters.Add("@Type", SqlDbType.VarChar, 50);
                SqlCmd.Parameters["@Type"].Value = Type;

                if (myConnection != null) { myConnection.Close(); }

                myConnection.Open();
                SqlAdapt = new SqlDataAdapter(SqlCmd);
                SqlAdapt.Fill(ds);
            }
            catch (Exception e)
            {
                MessageBox.Show("DAL Layer / AllowedTypes method error. \n\r \n\r" +
                    e.Message.ToString() + " \n\r \n\r" + SQL);
            }
            finally
            {
                if (myConnection != null) { myConnection.Close(); }
                if (SqlCmd != null) { SqlCmd.Dispose(); }
                if (SqlAdapt != null) { SqlAdapt.Dispose(); }
            }
            
            return ds;
        }


I don't use DataGridView much, but I was wondering if I neglected to create the columns or something. I confirmed the dataset being returned full of data.

Also I am trying update the information on the table if a user changes it on the DataGridView (see btnUpdate event).

Thank you, WHEELS
AnswerRe: C# Dataset bind to DataGridView update tabel in SQL Server 2005 DB Pin
Adam R Harris6-Aug-09 9:58
Adam R Harris6-Aug-09 9:58 
AnswerRe: C# Dataset bind to DataGridView update tabel in SQL Server 2005 DB Pin
Wheels01210-Aug-09 7:10
Wheels01210-Aug-09 7:10 
Question"Screenshot" from handle? Pin
dandy726-Aug-09 9:33
dandy726-Aug-09 9:33 
AnswerRe: "Screenshot" from handle? Pin
pelnor7-Aug-09 4:25
pelnor7-Aug-09 4:25 
GeneralRe: "Screenshot" from handle? Pin
dandy728-Aug-09 4:28
dandy728-Aug-09 4:28 
QuestionCalling functions and methods in a child form Pin
alias bill6-Aug-09 9:24
alias bill6-Aug-09 9:24 
AnswerRe: Calling functions and methods in a child form Pin
OriginalGriff6-Aug-09 10:20
mveOriginalGriff6-Aug-09 10:20 
AnswerRe: Calling functions and methods in a child form Pin
DaveyM696-Aug-09 10:54
professionalDaveyM696-Aug-09 10:54 
GeneralRe: Calling functions and methods in a child form Pin
alias bill6-Aug-09 12:02
alias bill6-Aug-09 12:02 
GeneralRe: Calling functions and methods in a child form Pin
DaveyM696-Aug-09 21:54
professionalDaveyM696-Aug-09 21:54 
AnswerRe: Calling functions and methods in a child form [modified] Pin
nelsonpaixao6-Aug-09 13:58
nelsonpaixao6-Aug-09 13:58 
QuestionUsing a Session variable in an UpdateCommand Pin
JohnQuar16-Aug-09 9:17
JohnQuar16-Aug-09 9:17 
AnswerRe: Using a Session variable in an UpdateCommand [ Posted on Wrong Forum ] Pin
Abhijit Jana6-Aug-09 9:24
professionalAbhijit Jana6-Aug-09 9:24 
QuestionMS word tables using C# Pin
Member 41540746-Aug-09 9:00
Member 41540746-Aug-09 9:00 
AnswerRe: MS word tables using C# Pin
toby316-Aug-09 12:01
toby316-Aug-09 12:01 
GeneralRe: MS word tables using C# Pin
Member 41540746-Aug-09 21:51
Member 41540746-Aug-09 21:51 
GeneralRe: MS word tables using C# Pin
toby316-Aug-09 22:09
toby316-Aug-09 22:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.