|
Split the dataset into 2 datasets or datatables that contain fields from only one table, and then use these to update the database.
I will use Google before asking dumb questions
|
|
|
|
|
I won't write the code for you...try to do something and if you get stuck...post a question with your problem.
I will use Google before asking dumb questions
|
|
|
|
|
Hi,
I got a problem that I would like to return a generic object in a non-generic object, what can I do?
I searched a lot of page but it's talking about how to use or implement a generic class, but if I want to implement a normal class and return a generic object according parameter, what can I do?
e.g.
class DaoFactory
{
Dao<T, IdT> GetDao(Type t)
{
//something like this.
//how to implement?
}
}
Thanks
Jr. P
calendarw
|
|
|
|
|
How about this one?
/// <summary>
/// Convert an ArrayList from a derived type to the base type
/// </summary>
/// <typeparam name="S">Derived type</typeparam>
/// <typeparam name="D">Base type</typeparam>
/// <param name="list">The ArrayList</param>
/// <returns>An ArrayList containing elements converted to the base type</returns>
public static List<D> Transform<S, D>(List<S> list) where S : D
{
List<D> lst = new List<D>();
foreach (S element in list)
lst.Add(element);
return lst;
}
I will use Google before asking dumb questions
|
|
|
|
|
Thank you.
I changed to this:
public static List<D> Transform<D>(System.Collections.IList list)
{
List<D> lst = new List<D>();
foreach (D element in list)
lst.Add(element);
return lst;
}
Actually, I tried to search using google but I don't know what keyword should be used for this case.
|
|
|
|
|
How about [this]
Hope it helps.
I will use Google before asking dumb questions
|
|
|
|
|
Thank you for your information.
And I would like to implement something like this:
public interface IReadOnlyDao
{
object GetById(object id);
IList GetAll();
}
public interface IReadOnlyDao<T, IdT> : IReadOnlyDao
{
T GetById(IdT id);
IList<T, IdT> GetAll();
}
But when I implementing the GetAll(), I got a problem that two method are same name and same parameter, is it possible to implement? or I am required to use convert the list using previous discuss method.
Thank you very much.
|
|
|
|
|
I think it will be better to use the converter. My opinion
I will use Google before asking dumb questions
|
|
|
|
|
|
how to add support for "text drag and drop" for a console application in .NET ?
it has to accept dropped text on the console window.
thanks.
|
|
|
|
|
A drop target must be there enabled in the application for it to accept drag and drop requests. Isn't it?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
not sure how I do this for a "Console" object.
|
|
|
|
|
|
hmm interesting, thanks,
still I was hoping for something more human
|
|
|
|
|
Hi...
I have problem with my timer code.
I want to display the data from the sql database on textbox using timer tick event.
For an example there are 3 data in the database which are apple,banana,coconut.
apple will appear first and after 10 seconds banana will appear, and after 10 seconds coconut will appear. And then, after the last data (coconut) appeared, the first data (apple) appeared again, and so on. It will continuously loop.
I want to do like this. Any suggestion or reference?
Thanks
Jac
|
|
|
|
|
jacklynn_mei wrote: It will continuously loop.
If you are looking at providing some interactive DHTML effect, I would suggest you look into:
http://script.aculo.us/[^]
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Do you want to do this in a web or desktop application?
I will use Google before asking dumb questions
|
|
|
|
|
|
Then, why don't you just query the database, store what you have retrieved in an object, DataSet, List...whatever...and then at the specified interval you just show a value form that object (you can use in this case a counter too).
Hope it helps.
I will use Google before asking dumb questions
|
|
|
|
|
I have done something like the code below
But after reading the last data, it encounter error since there is no data persistent while reading.
public partial class tempA : Form
{
SqlDataReader m_Reader;
DataSet ds = new DataSet();
private void tempA_Load(object sender, EventArgs e)
{
string conStrg;
conStrg = ("Data Source=DIMENSION3000\\SQLEXPRESS;Initial Catalog=kMasjid;User ID=sa;password=123456");
SqlConnection connTimer = new SqlConnection(conStrg);
connTimer.Open();
string selSQL = "Select txtDesc FROM txtScroll";
SqlCommand com = new SqlCommand(selSQL, connTimer);
SqlDataAdapter da = new SqlDataAdapter(com);
da.Fill(ds, "txtScroll");
m_Reader = com.ExecuteReader();
m_Reader.Read();
Timer myTimer = new Timer();
myTimer.Interval = 5000;
myTimer.Enabled = true;
myTimer.Start();
myTimer.Tick += new EventHandler(Timer_Tick);
}
public void Timer_Tick(object sender, EventArgs e)
{
alphaTxtMain.Text = " " + m_Reader["txtDesc"];
m_Reader.Read()
}
}
|
|
|
|
|
public partial class tempA : Form
{
SqlDataReader m_Reader;
DataSet ds = new DataSet();
int counter = 0;
private void tempA_Load(object sender, EventArgs e)
{
string conStrg;
conStrg = ("Data Source=DIMENSION3000\\SQLEXPRESS;Initial Catalog=kMasjid;User ID=sa;password=123456");
SqlConnection connTimer = new SqlConnection(conStrg);
connTimer.Open();
string selSQL = "Select txtDesc FROM txtScroll";
SqlCommand com = new SqlCommand(selSQL, connTimer);
SqlDataAdapter da = new SqlDataAdapter(com);
da.Fill(ds, "txtScroll");
m_Reader = com.ExecuteReader();
m_Reader.Read();
Timer myTimer = new Timer();
myTimer.Interval = 5000;
myTimer.Enabled = true;
myTimer.Start();
myTimer.Tick += new EventHandler(Timer_Tick);
}
public void Timer_Tick(object sender, EventArgs e)
{
alphaTxtMain.Text = " " + ds.Tables[0].Rows[counter++]["txtDesc"];
}
}
I will use Google before asking dumb questions
|
|
|
|
|
Thanks...
But after tried, it wont loop to the first data. After reading the 3rd data, it will error since there is no data on the position 3 (4th data) (my table only have 3 data).
|
|
|
|
|
Do we have to do everything for you? Test the counter...if it reaches the end of the DataSet, set it to 0.
I will use Google before asking dumb questions
|
|
|
|
|
Thank you very much...You've help me a lot...
Thank you...
|
|
|
|
|
Glad it turned out alright.
I will use Google before asking dumb questions
|
|
|
|