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
Pieter Twentyeight
NA
37
11.3k
DataSource for DataSet
Nov 26 2012 4:15 AM
I think my previous post was not clear enough. Here is some code to explain
So in the GUI I think there is some issue because my datagrid isnt filled at all... :-(
Please quick help?
GUI
+++
PersonBLL _localpers = null;
DataSet _localds = null;
private void button1_Click_1(object sender, EventArgs e)
{
try
{
_localds = new DataSet("GeneralInfo");
_localds = PersonBLL.GetAddressesFromPerson(textBoxBranchName.Text);
dataGridViewAddresses.DataSource = _localds.Tables["Addresses"];
dataGridViewAddresses.Refresh();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Person",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
BLL
+++
public static DataSet GetAddressesFromPerson(string name)
{
try
{
return PersonDAL.GetAddressesFromPerson(name);
}
catch (BranchDALException ex)
{
throw new PersonBLLException(ex.Message);
}
catch (Exception ex)
{
throw new PersonBLLException(ex.Message);
}
}
DAL
+++
public static DateSet GetAddressesFromPerson(string name)
{
try
{
int persid = PersonDAL.GetPersonID(Name);
string sql = "SELECT * FROM ADDRESS WHERE
PersonId=@persid
";
CommandParameterList localparams = new CommandParameterList();
localparams.Add(new CommandParameter("@persid", persid, DbParameterTypes.Int32, ParameterDirection.Input));
localDAC.LocalParameters = localparams;
return localDAC.ExecuteDS(sql, AssignmentTypes.SqlStatement, "Addresses");
}
catch (SQLDacException ex)
{
throw new PersonDALException(ex.Message);
}
catch (Exception ex)
{
throw new PersonDALException(ex.Message);
}
}
Reply
Answers (
1
)
How to refresh xml file when using XmlTextReader(string url)
How to Create XML table using C#