|
Hi folks,
it seems to be a serious problem. I would like to thank all peoples who read the thread and thinking about it. I have solved this issue with a VB.DLL I wrote and call in C#. If you have another suggestion please post.
Regards
gremgiz
|
|
|
|
|
Hi
i'm looking for some tips and tricks about how to insert into relational data (Master/Detail) at the same time.
for example, user want to create new Customer, open Customer form to set it's values and insert some Orders for that Customer (which did not inserted into database yet) in Orders section, then save all together at the same time to database.
can anybody help me and has experience for this issue ?
thanks
|
|
|
|
|
A transaction could be used to wrap both insert statements into an atomic operation that would "behave" like a single statement.
I are troll
|
|
|
|
|
Thanks Eddy
I know this which run these operations under a single transaction, but my problem is that how to insert foreign key (from Customers) in to order record (because new customer has not been inserted yet, hence it does not a valid Primary key). i'm looking for some tips and tricks about this operation.
|
|
|
|
|
I think I don't understand exactly what you want/need. Would this help, or am I missing something in your question?
BEGIN TRANSACTION
INSERT INTO Customers (CustName) VALUES ('John') -- Id field is identity, and therefore not named in the fieldlist.
DECLARE @custId AS BIGINT
SELECT @custId = @@IDENTITY -- put new custId key into "@custId" var
INSERT INTO ORDER (OrderId, CustomerId) VALUES (1, @custId)
COMMIT TRANSACTION
I are troll
|
|
|
|
|
Thanks Eddy
I want almost this, but it's good for a one Order. how to do that for multiple Order at the same time ?
Note(Guide) : i want to iterate in Orders dataTable and insert each order into database.
|
|
|
|
|
It's good for an employee and an order. You can put as many SQL-statements in there as you want, SQL Server will keep treating them like an atomic operation
Put the start-transaction and the identity-retrieve statements in a string, and concatenate insert-statements for each order. When done, add the commit-transaction statement (or a rollback in case of error) and execute the string.
I are troll
|
|
|
|
|
Thanks again Eddy
It's good, but i have problem to pass dataTable to stored procedure withing a single transaction.
|
|
|
|
|
What you need to do is that after installing the customer. Fetch the customer id..
And then you can make an overloaded method to save an order where you provide the customerid..
And in that method code it in such a way that the customer id given differently is used and not on the table of orders. .
|
|
|
|
|
i am adding one custom property to textbox.when i click on this item i need to show one form (like popup window).and this form having one textbox and one button..after entering the text in textbox and click on ok button.i need to display the text in this custom property item..
please any one help me.
|
|
|
|
|
set ReadOnly(true) and Browsable(true)
|
|
|
|
|
Oh, man, please do not post duplicated question here. Nobody like this!
I Love KongFu~
|
|
|
|
|
Hi ,
i have a strange requirement...ie
i have an EXE in the website folder under IIS in server...and
i can access that exe from client thru url...
but i need to run that exe(which is in server) in client thru a dialog based application ie on buttonclick i need to run the exe in client...
what i did is on buttonclick event im trying to run cmd in the background in which im sending the parameters--> iexplore http://machinename/websitename/my.exe" when i run this im able to run the exe in client but IE browser is opening ....i do"nt want to display IE browser but the exe should run...(if this is not a better way pls let me know how can i run exe from server in client or i need to copy exe from server and paste in client and i run the exe without using server login credentials...)...
|
|
|
|
|
Using the following code you can download the exe in a local folder and then execute it:
System.Net.WebRequest request = System.Net.WebRequest.Create(remoteExe);
using (System.Net.WebResponse response = request.GetResponse())
{
using (System.IO.Stream stream = response.GetResponseStream())
{
byte[] content = new byte[response.ContentLength];
stream.Read(content, 0, content.Length);
System.IO.File.WriteAllBytes(localExe, content);
}
}
System.Diagnostics.Process.Start(localExe);
modified on Thursday, March 5, 2009 10:45 AM
|
|
|
|
|
thanks for this sample, it works.
But I have a problem. When I try to execute the copied .exe it doens't work.
File has same size..
What migth be wrong?
|
|
|
|
|
pradeep455 wrote: iexplore http://machinename/websitename/my.exe"
this will fire IE in deed.
You can not run an exe on the server from the client. What you can do it, download the exe to the client, then run it on the client.
Yusuf
|
|
|
|
|
How to connect microsoft access to c#.net? And how can i update tables in c#.net?
|
|
|
|
|
look into the system.data.oledb namespace
specifically the oledbconnection and oledbcommand classes
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
Did you even try to Google for an example? There's an example here[^], good luck
I are troll
|
|
|
|
|
Google ado.net
I Love KongFu~
|
|
|
|
|
Hi All
I have C# dll developed now I want to access it using JavaScript in ASP
I need to Register it as COM Server?
How can I do that
Thansk!
Develop2Program & Program2Develop
|
|
|
|
|
Yep, and your class library should have been written to support this from the start.
|
|
|
|
|
Navneet Hegde wrote: I need to Register it as COM Server?
Yes.
Navneet Hegde wrote: How can I do that
1.Use interface and implement it as what you want to do
2.Make the .TLB (type library file) for your C# dll
3.Register TLB
I Love KongFu~
|
|
|
|
|
Hi
How can I activate Event ?
for example: to activate the Form_Load from my Button in the Form
thank's
|
|
|
|
|
Form1.OnLoad();
I cant say how it will work thou, i not tried it
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|