TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Keerthika Reddy
NA
21
616
Object reference not set to an instance of an object
Nov 12 2018 1:56 AM
private void GetColumns(string key, DataGridView dataGrid)
{
string strQuery = string.Format("select col_index, col_name, display_name, col_type, visible, col_width from rayonpos.datagridcolumns where source_key = '{0}' order by col_index", key);
DataTable dtColumns = DataService.ExecuteQueryAndReturnTable(strQuery);
if (dtColumns.Rows.Count > 0)
{
dataGrid.Columns.Clear();
foreach (DataRow dtRow in dtColumns.Rows)
{
DataGridViewColumn dgvCol = null;
if (dtRow["col_type"].ToString().ToUpper() == "TEXT")
{
dgvCol = new DataGridViewTextBoxColumn();
}
dgvCol.Name = dtRow["col_name"].ToString();
dgvCol.HeaderText = dtRow["display_name"].ToString();
dgvCol.Visible = Convert.ToBoolean(dtRow["visible"]);
dgvCol.Width = Convert.ToInt16(dtRow["col_width"]);
dataGrid.Columns.Insert(Convert.ToInt16(dtRow["col_index"]), dgvCol);
}
}
}
Reply
Answers (
3
)
I want delete one record in session
Ouput in decimals