|
If you have added a record and want to find out the id that the record recieved:
Access: select @@identity
MySQL: select last_insert_id()
MSSQL: select scope_identity()
Getting the largest id after adding a record is a very very bad method to get it's id. It works flawlessly when you are testing the system by yourself, but in a multi user system you will get the wrong id sometimes as another user added a record at the same time. The more users, the more frequent the errors will be.
---
b { font-weight: normal; }
|
|
|
|
|
thanks for ur reply ..
atlast , do I use this ?
<br />
"select max(IdColumnName) from TableName"<br />
s_mostafa_h
|
|
|
|
|
No, not if you just added a record and want to find out what id it got. Then you use one of the queries I showed.
You can use it if you want to find out what the highest id is in the table, but that information really isn't very useful. One millisecond after you got the value, another record could be added by someone else, and the information is outdated.
---
b { font-weight: normal; }
|
|
|
|
|
Does anyone know how to safely inherit from a "Form"? When I do this my owned Form stops be robust in Design mode.
Thanks for advance.
HZ
|
|
|
|
|
hi to all,
i'm working with xml data. i extract the data from an sql server data base via a stored procedure.
the result of the executed procedure is an XmlTextReader.
i'm trying to copy the content of the into a physical file on the hard disk.
i tried two solution.
first one consist on loading the reader into an XmlDocument and save it to the disk
the second consist on a loop on the reader and creating the xml file manually.
the problem is : when the procedure brings a lot of data,
sometimes i have some tags or attributes
wrapped between two lines.
like this : >mytag first_attrib="1" second_attrib="2" third_attr
ib="3"/>
or >anothertag first_attrib="1" second_attrib="2"/> >an
othertag third_attrib="3" fourth_attrib="4"/>
you can notice that in the first example the attribute is wrapped on two lines
and in the second case the tag is wrapped on two lines
so when i tried to load the reader into an xmldocument, i got an error message.
and when i tried to loop through the reader, i also got an error when the reader
arrive to the wrapped attribute (third_attrib in my examples)
the question is how can i solve the problem of wrapped tags or attributes ?
does anyone has a solution to my problem ?
best regards and thanks in advance
fady
|
|
|
|
|
hi to all,
i'm working with xml data. i extract the data from an sql server data base via a stored procedure.
the result of the executed procedure is an XmlTextReader.
i'm trying to copy the content of the into a physical file on the hard disk.
i tried two solution.
first one consist on loading the reader into an XmlDocument and save it to the disk
the second consist on a loop on the reader and creating the xml file manually.
the problem is : when the procedure brings a lot of data,
sometimes i have some tags or attributes
wrapped between two lines.
like this : <mytag first_attrib="1" second_attrib="2" third_attr
="" ib="3">
or <anothertag first_attrib="1" second_attrib="2"><an
othertag="" third_attrib="3" fourth_attrib="4">
you can notice that in the first example the attribute is wrapped on two lines
and in the second case the tag is wrapped on two lines
so when i tried to load the reader into an xmldocument, i got an error message.
and when i tried to loop through the reader, i also got an error when the reader
arrive to the wrapped attribute (third_attrib in my examples)
the question is how can i solve the problem of wrapped tags or attributes ?
does anyone has a solution to my problem ?
best regards and thanks in advance
fady
|
|
|
|
|
Hi,
I have a UserControl that contans an image and CAN also contan text ( using DrawString()).
I have a panel that has several of these UserControls that I can move around with a mouse ( using drag-drop).
What I would like to do, however, would be to be able to rotate the UserControl : ie: left 30 degrees or right 30 degrees or even upside-down.
I see various tools using Graphics/Matrix to be able to do that within a window, but I still end up with a regular square with an image in it.
My user control is basically a button and I would like to show the button at a 30 degree angle or upside down based on other logic.
Thanks
Gary
Just for the fun of it !
|
|
|
|
|
Sounds like you're working on a fun app! Unfortunately there is no support in WinForms (or Win32 for that matter) for rotating controls. The best you could do is display images instead of the Button (user control). Since bitmaps can be rotated, you could probably, with lots of effort, make it look and feel pretty cool using images.
If you have the option, I'd say develop this app using WPF. WPF has huge support for transforms, animations, and all types of visually exciting effects. I've been studying it now for about a month and am more and more amazed by it every day!!
Josh
|
|
|
|
|
I want to run an Office Communicator inside a User Control. I do not want it to open as a new window, but instead inside my panel. This is the code I have tried:
Process comm = new Process();
comm.StartInfo.CreateNoWindow = true;
comm.StartInfo.FileName = @"C:\Program Files\Microsoft Office Communicator\communicator.exe";
comm.Start();
The problem is that the Communicator is opened, but not inside my User Control. Does someone know how to solve this problem?
|
|
|
|
|
What you are trying to do is wrong, this is conceptuelly wrong.
Try to do the communicator as an embed control to your application,
HZ
|
|
|
|
|
|
How to set endtime time to playing audio file ...
|
|
|
|
|
Hello all,
I have to develop one application in which i can capture all packet passing thru my NIC. If u want more idea about this then see ethereal[^].
Divyang Mithaiwala
|
|
|
|
|
Search in codeproject.com using a keyword "packet capture".
You will get a lot of articles there.
|
|
|
|
|
Hello stancrm,
Thanx. Actually i have search for Articles but i use different key words. And i a fail. But your key word is good.
Thanx again.
Regards,
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
Why reinvent the wheel? You can get ethereal free. It is an excellent program, plus it can insert into the network in promiscuous mode
|
|
|
|
|
Hello,
My project is start from ethereal. And go more far from this. I have to analyze voip traffic. And also manage it.
regards,
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
There is a winpcap .NET wrapper here on CP IIRC. Just search
|
|
|
|
|
Hi,
Looking for code to show after selecting from a combo box 3 other combo boxes and a submit button
Thanks,
Daniela
|
|
|
|
|
Make the visible property false at start up
and then in the combobox_selectindex method make all controll's
visible property true.
Rahul Kulkarni
|
|
|
|
|
Hi again,
I'm quite fresh here - so could you please be more specific about "combobox_selectindex method make all controll's
visible property true" ?
Thanks,
danish_bear
|
|
|
|
|
You can double click the drop down in the design , it will open the cede page with selected index changed event.
There you can write code to make other dropdown visible.
Set autopostback property of dropdown to true
|
|
|
|
|
Hi Daniela, If I read your request right, you want something like this perhaps?
private void Form1_Load(object sender, EventArgs e)
{
//some magic code you need at form initialization goes here
//probably code that populates the combo boxes with whatever
//values you need at startup or populate on the fly as in the
//below event handler
//Set your form objects to be hidden or alternatively, you can
//set them to be hidden when they're initially created
MySecondComboBox.Visible = false;
MyThirdComboBox.Visible = false;
MyFourthComboBox.Visible = false;
MySubmitButton.Visible = false;
}
private void MyFirstComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
//populate the combo boxes before making them visble
PopulateMySecondComboBox();
PopulateMyThirdComboBox();
PopulateMyFourthComboBox();
//now make them visble
MySecondComboBox.Visible = true;
MyThirdComboBox.Visible = true;
MyFourthComboBox.Visible = true;
MySubmitButton.Visible = true;
}
There's supporting code for all this of course, but I will leave that to you. Hope this helps!
Mike Poz
|
|
|
|
|
Yes - I could use this (:
Thanks !!!!
Daniela
danish_bear
|
|
|
|
|
Hi,
Looking for a c# code to show within a table the selection of a combo box in the appropriate column of the table after pressing a submit button( table, combo box, submit button are in the same form)
Thanks,
danish_bear
|
|
|
|