|
Hi all !
I've 3 sql table :
table1(maintable):id_car[primarykey],id_service,name_car ,
table 2:id_service[primary key] , kind_service
and table3 :myid[primarykey],id_car,company
Relations :table1 - table2(many to one) ,table1-table3(one to many)
I want to select name_car,kind_service,copany for filling a dataset in a crystal report(to taking a Report)and for this , I added an Item Data Set in my project .According to the relation between tables(table1,table2,table3),
for one table(without considering the relation) I wrote :
myDataset ds=new myDataset();<br />
strConnection.Open();<br />
string strSQL = "SELECT * FROM table1";<br />
dataadapter1 = new SqlDataAdapter(strSQL,strConnection);<br />
SqlCommandBuilder scb = new SqlCommandBuilder(dataadapter1);<br />
dataadapter1.Fill(ds.table1);<br />
CrystalReport1.SetDataSource(ds.table1);<br />
crystalReportViewer1.ReportSource=CrystalReport1;
but I dont't know , how can I fill myDataset when there is 3 table ??.
Thanks for any help.
Regards !
s_mostafa_h
|
|
|
|
|
hi everybody
i have a web site which specifies profile to my users.
my web site registeration policy is for the first step sending mail to anybody who requests to signup in my web site.(just like gmail Invitation)
but recently most of my web application mails to yahoo server will be spam or bulk.
i think the yahoo server make all of my site mails to spam or bulk.
what should i do.
my site is so Famous in my country and i have more than 500 sign up request everyday.
what should i do with this problem.
Thanks
Rastegar
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
|
what do you mean?!
please answer me more clear.
Thanks
Rastgar
|
|
|
|
|
|
Hello ...
If i have transactions for the 3 subsequent commands to execute, is database locked for this time to prevent interruption by other threads (automatically) ? Or must I use lock statement for this purpose ?
|
|
|
|
|
|
Hi Colin'
Thanks for your reply.
Actually my question was like this,
Situation,
{
command A
commandA.transaction = transactionA
commandB
commandB.transaction = transactionA
commandC
commandC.transaction = transactionA
// execute all commands
transactionA.commit
}
Now , do I need to lock the mentioned block as I am already using Transaction. You replied me saying that, database will not be locked, I should use transaction. I am confused. Did you mean if I use transaction then SQL will be locked ? if so, then thats what was my question
|
|
|
|
|
emran834 wrote: do I need to lock the mentioned block as I am already using Transaction.
You do not need to use the C# keywork lock in this situation.
emran834 wrote: You replied me saying that, database will not be locked, I should use transaction.
If you use the lock keyword, all you are doing is locking other threads from the same application out. However, other applications can still access and modify the database.
emran834 wrote: Did you mean if I use transaction then SQL will be locked ?
If you use the transaction SQL Server will ensure that no other process can modify the same part of the database that you are modifying.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Thanks Colin for detailed and explained answer.
|
|
|
|
|
I have a code structured like this:
Class A {<br />
...
private void methodA () {<br />
B b = new B();<br />
...
}<br />
<br />
}<br />
<br />
Class B {<br />
...
~B() {...}<br />
}
will the destructor run in class B when the methodA in class A finishes? If not, how can i make it run?
|
|
|
|
|
When the garbage collector finds an object with a destructor, it places it on a special queue, hence the destruction of an object is not deterministic (you cannot predict when it happens).
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
No, it wont. The destructor will be called when the garbage collector is about to remove the object.
If you want some clean up in the object, let the class inherit the IDisposable interface. When you are done with the object, call the Dispose method to do the clean up.
A good way of disposing of objects is using the using keyword. That will create a try...finally block with the Dispose call in the finally part. That ensures that the Dispose method is always called, whatever happens.
Class A {
...
private void methodA () {
using (B b = new B()) {
...
}
}
}
Class B : IDisposable {
...
~B() {
this.Dispose();
}
public void Dispose() {
...
}
}
---
b { font-weight: normal; }
|
|
|
|
|
I have this:
internal enum WelcomeData { Language, NumCusAdult, NumCusUnder4, NumCusUnder9, NumCusSenior, TimerEnable };
Everytime I use the enum as index in an array I have to cast it as int:
Data[(int)WelcomeData.Language] = Language;
This is very annoying
how do i make the enum act as int?
thx thx
|
|
|
|
|
Emm, subclass the array and define an indexer that take in the enum type?
|
|
|
|
|
I need to customize my windows application install wizard so that it will a config text file. (something like a .ini). The user must input something during install, and the file will be created when installed.
How can i do that? Where can i find a complete tutorial on customizing installation?
|
|
|
|
|
Hi,
I'm writing a process manager as my first real 'project,' I've got all the info into a listview (including the pid) and a kill method that works if you manually enter the pid but how would I go about extracting the pid and passing it to the method based on which row has been clicked ?
TIA.
-- modified at 3:59 Sunday 26th February, 2006
|
|
|
|
|
if(listBox1.SelectedIndex >= 0)
{
string a = (string)listBox1.SelectedItem;
// do you stuff here to extract the pid from string a
KillDaProcess(pid);
}
or use SelectedItems and loop thru the items if you allow user to multi-select
|
|
|
|
|
Gah, I meant listview rather than box, sorry.
Though I tried something like that initially, but it just kept returning "System.Windows.Form.ListView + SelectedListViewItemCollection" and nothing much to do with whats actually in the table.
|
|
|
|
|
I've managed to get the name out of the first column using lstProcesses.SelectedItems[0].Text, just have to figure out how to get it out of the third column
|
|
|
|
|
if you use listview, there is a Tag property that let you... hmm.. tag an object to an Item or SubItem.
You can just tag the pid string to Item's Tag, or you can tag a class containing the pid string + other stuffs to the tag.
So once you are able to get the SelectedItem, just take the object from Tag and that will be your pid.
Array array = listView1.SelectedItems;
if(array.Count>0)
{
for(int i=0; i
|
|
|
|
|
Ah that works brilliantly, cheers man
|
|
|
|
|
Hi,
I have extended a DataGridView class to add some custom event handling. I have a number of TextBox columns. I trap a Key Event and put a specific column into Edit mode. However, after the user completes their update and presses "Enter", I need to direct the focus to a new cell. By default the EndEdit call seems to move directly to the cell below. How do I override this?
I need to move the focus to another cell in the same row. Does anyone have a code snippet?
|
|
|
|
|
I am using MS Visual C# 2003 with Net 1.1. I can't seem to figure out how to compile code on multiple files without compiler complaints. What am I doing wrong? Thanks ahead o' time.
From Morse code... to DNA. All the universe is code.
|
|
|
|