| | |
converting and sending data problem
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2007
Posts: 5
Reputation:
Solved Threads: 0
Hi,
I want to send the FK from parent table to child table by getting the object with executescalar and converting the value of it to string and then to integer finally pass it to child table. The problem is that the converted data will lose the information. I mean it will become NULL.
This is how did I do:
insertCommand.CommandText = "SELECT @@IDENTITY AS P_ID ";
SqlParameter pIDParameter = new SqlParameter("@P_ID", SqlDbType.Int);
pIDParameter.Direction = ParameterDirection.ReturnValue;
object o = insertCommand.ExecuteScalar();
string s = o.ToString();
int P_ID = Int32.Parse(s);
what is the better way to the convertion or better way to pass it to child table?
I want to send the FK from parent table to child table by getting the object with executescalar and converting the value of it to string and then to integer finally pass it to child table. The problem is that the converted data will lose the information. I mean it will become NULL.
This is how did I do:
insertCommand.CommandText = "SELECT @@IDENTITY AS P_ID ";
SqlParameter pIDParameter = new SqlParameter("@P_ID", SqlDbType.Int);
pIDParameter.Direction = ParameterDirection.ReturnValue;
object o = insertCommand.ExecuteScalar();
string s = o.ToString();
int P_ID = Int32.Parse(s);
what is the better way to the convertion or better way to pass it to child table?
![]() |
Similar Threads
- Winsock C++ help: receiving data (C++)
- Send data on a serial port (C++)
- getting data from a text file and putting it in an excel file using visual basic 6.0 (Visual Basic 4 / 5 / 6)
- Sending data through MSMQ (VB.NET)
- ComboBox bind data problem (VB.NET)
- Sending single byte data (Visual Basic 4 / 5 / 6)
- MFC Socket programming problem (C)
- my cpu is sending too much data to the server (Viruses, Spyware and other Nasties)
Other Threads in the C# Forum
- Previous Thread: Internet Application
- Next Thread: Maths problem
| Thread Tools | Search this Thread |
.net access algorithm animation array barchart bitmap box broadcast buttons c# check checkbox client code combobox control conversion csharp custom database datagrid datagridview dataset datastructure datetime degrees development directrobot draganddrop drawing encryption enum event excel file form format forms function gdi+ hash httpwebrequest image index input install java label lisp list listbox mandelbrot math mouseclick mp3 mysql native operator path photoshop picturebox pixelinversion post print process programming radians regex remote remoting richtextbox safari server sleep snooze socket sql statistics stream string table tables tcp text textbox thread time timer update usercontrol usercontrols validation visualstudio webbrowser wfa windows winforms wpf xml





