|
How do I do this in database?
|
|
|
|
|
arkiboys wrote: How do I do this in database
The conversion to a database will be time consuming and possibly difficult, depends on the structure of your xml file, but will repay the effort many times over as time goes by.
I am not aware of any tools that can automate the process entirely, although if you create the database and tables manually you can use the bulk loading methods of SQL Server to load the data.
You can also do a sort of half-way-house thing. Look at the DataSet.ReadXml , DataSet.ReadXmlSchema methods and the associated Write ones.
Whether any of this is possible or practical depends mostly on the structure of your xml.
The earlier comments about a limit for LINQToXML was a joke so that avenue is still open to you.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I am now learning linq.
Many thanks
|
|
|
|
|
Henry Minute wrote: I wasn't aware of that.
I think he has his sarcasm hat on tonight
|
|
|
|
|
At least someone recognized it
only two letters away from being an asset
|
|
|
|
|
I sort of half thought so because of the emoticon he used and I googled before asking for a link. I am however very gullible and you can never be sure.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
arkiboys wrote: Should I use xmlDocument?
I would; I don't do Linq.
|
|
|
|
|
Im creating a program which is signed. And ive referenced a usercontrol that I have made. But when I build it says:
Error 1 Assembly generation failed -- Referenced assembly 'dll name here' does not have a strong name
But surely if I signed the dll then the strong name file wont get included in the dll making it pointless?
So how do I fix this? Keeping in mind I need to be able to install this on other pc's.
Thanks
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
You're right, Microsoft has just strung us all along for the last eight years with assembly signing and strong names, all to find out it is pointless.
Strong Names Explained[^]
only two letters away from being an asset
|
|
|
|
|
Hi if you add strong name for one dll, then you should use strong name for all the places, where you use that dll. for example i have added strong name for one class library project and i need to use strong name where i use (refer) the class also...
|
|
|
|
|
Hello everyone,
I am trying to send an array of bytes using the serial port and I get a strange I/O exception. In my opinion there is no reason for the error. Here is the code;
SerialPort comport = new SerialPort("COM1", 57600, Parity.None, 8, StopBits.One);
comport.Open();
byte[] data = new byte[16];
comport.Write(data, 0, 16);
The details for the exception is "The I/O operation has been aborted because of either a thread exit or an application request".
How and why a write function can give an exception? Any ideas will be appreciated
zafer
|
|
|
|
|
Can you post the Exception details.
And
Is the COM1 port , begin opened by another Application ?
Or did it Exist ?
I know nothing , I know nothing ...
|
|
|
|
|
Hi,
is the code shown all part of a single method?
are multiple threads involved? (including ThreadPool, BackgroundWorker, ...)
did you use CheckForIllegalCrossThreadCalls anywhere?
are you using one of the asynchronous events, such as DataReceived?
where in the code is comport.Close()?
you probably simplified your code before showing to such an extent that we cannot help you, unless you tell more and show more code.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi,
I am getting a similar error. I am just trying to read from a serial COM port. It works fine. Then if I open and close the COM port a few times I get the following error when trying to open again:
The I/O operation has been aborted because of either a thread exit or an application request.
Starnagely enough the error is still tehre if I stop debugging (VisualStuio 2008, vb.net) and start again. The only way I can get it to work again is by opening and closing the port with hyperterminal!
Here is my wrapper class:
Public Class clComPort
Private WithEvents comPort As System.IO.Ports.SerialPort
Private write As Boolean = True
Private bAllowSndRcv As Boolean = False
Private thRec As System.Threading.Thread
Public Event WroteData(ByVal msg As String)
Public Event DataRecieved(ByVal msg As String)
Public Event COMError(ByVal msg As String)
Public Function OpenPort(ByVal ComNum As Integer, ByVal baudRate As Integer, ByVal dataBits As Integer, _
ByVal parity As IO.Ports.Parity, ByVal stpBits As IO.Ports.StopBits) As Boolean
bAllowSndRcv = False
Try
'first check if the port is already open
'if its open then close it
If Not IsNothing(comPort) Then
Me.ClosePort()
End If
comPort = New System.IO.Ports.SerialPort()
'set the properties of our SerialPort Object
comPort.BaudRate = Integer.Parse(baudRate)
comPort.DataBits = Integer.Parse(dataBits)
comPort.StopBits = stpBits
comPort.Parity = parity
comPort.PortName = "COM" & ComNum
comPort.ReadTimeout = 500
comPort.WriteTimeout = 500
'now open the port
Dim b As Boolean = comPort.IsOpen
comPort.Open()
bAllowSndRcv = True
'return true
Return True
Catch ex As Exception
bAllowSndRcv = False
RaiseEvent COMError(ex.Message)
Return False
End Try
End Function
Public Sub ClosePort()
bAllowSndRcv = False
If IsNothing(comPort) Then Exit Sub
If comPort.IsOpen Then
RemoveHandler comPort.DataReceived, AddressOf comPort_DataReceived
comPort.Close()
End If
comPort.Dispose()
End Sub
Private Sub comPort_DataReceived(ByVal sender As Object, _
ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles comPort.DataReceived
'This event will Receive the data from the selected COM port..
If Not bAllowSndRcv Then Exit Sub
If e.EventType = System.IO.Ports.SerialData.Chars Then
thRec = New System.Threading.Thread(AddressOf ReceiveData)
thRec.IsBackground = True
thRec.Priority = System.Threading.ThreadPriority.Highest
thRec.Start()
thRec.Sleep(10)
End If
End Sub
Private Sub ReceiveData()
If Not bAllowSndRcv Then Exit Sub
'Sub to Receive Data from the Serial Port, Will Run in a Thread
Dim bRead, nRead As Integer
' Dim returnStr As String = ""
Dim ascStr As String = ""
bRead = comPort.BytesToRead 'Number of Bytes to read
Dim cData(bRead - 1) As Byte
comPort.Encoding = System.Text.Encoding.GetEncoding(65001)
nRead = comPort.Read(cData, 0, bRead) 'Reading the Data
For Each b As Byte In cData
ascStr += Chr(b) 'Ascii String
' returnStr += Hex(b).PadLeft(2, "0") 'Hex String (Modified Padding, to intake compulsory 2 chars, mainly in case of 0)
Next
RaiseEvent DataRecieved(ascStr)
End Sub
Private Sub comPort_ErrorReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialErrorReceivedEventArgs) Handles comPort.ErrorReceived
RaiseEvent COMError(e.EventType.ToString)
End Sub
End Class
And here is the stack:
at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
at System.IO.Ports.InternalResources.WinIOError()
at System.IO.Ports.SerialStream.InitializeDCB(Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Boolean discardNull)
at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
at System.IO.Ports.SerialPort.Open()
at COMPort.clComPort.OpenPort(Int32 ComNum, Int32 baudRate, Int32 dataBits, Parity parity, StopBits stpBits) in D:\Source\MiscVB.Net\COMPort\clComPort.vb:line 33" String
Any ideas? Thanks,
Charlie
|
|
|
|
|
Hi,
this[^] says you shouldn't close and immediately reopen a serial port.
suggestion: check the port settings; if no change needed simply clear in- and out-buffer and go on; otherwise include a sleep.
BTW: why are you parsing integer parameters such as baudrate?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Hi,
Thanks for your answer. Ok, I will try the sleep. Interesting link you sent.
What I am worried about is that once it's locked into the:
ERROR The I/O operation has been aborted because of either a thread exit or an application request.
Port Open Failed.
it seems to stay there even if I start and stop my application again (both in dev environment in debug config, and using a released exe). The only way to unlock it is by opening and closing the port with hyperterminal. I wonder how I might be able to do this programatically?
Is there any ways to run a batch file to open and close a hyperterminal? It's not the best solution but will have to do for a quick-fix...
Thanks,
Charlie
|
|
|
|
|
I seem to have solved the issue by modifying my ClosePort sub to:
Public Sub ClosePort()
bAllowSndRcv = False
If IsNothing(comPort) Then Exit Sub
If comPort.IsOpen Then
comPort.DiscardOutBuffer()
RemoveHandler comPort.DataReceived, AddressOf comPort_DataReceived
Threading.Thread.Sleep(200)
comPort.Close()
End If
End Sub
|
|
|
|
|
Hi All
I am getting a problem in merging two datasets into one. Both datasets have the same schema, structure but different data. One of the datasets have data with null values in some columns. But I want them to merge and the final result should be that one of the dataset has all the rows.
Fyi, the two datasets were populated with data from excel files. Both excel files have same columns. But they can have null values in some of the columns.
Please help me to resolve this issue.
sri
|
|
|
|
|
Hi , have a good day
I am going to tell you something a little bit closer to your problem
Once I exported an Excel file to MS SQL server database
and when I call SQLDataReader it's throw Exception at null value
so I apply this Query on every sql table Column to Avoid this problem
UPDATE tbmain set customername = '' WHERE customername IS NULL
NULL is not ''
hope this help
kind regards ...
I know nothing , I know nothing ...
|
|
|
|
|
do the tables have "not null" on the destination table where the null values from the source table appear?
and do you want the rows with the NULLs?
|
|
|
|
|
Hi all,
I am doing windows applicaiton which has three columns such PID,ProcessName and Select, I have done check boxes for the select column.But now my need is
i want to add a check box in header, and enabling the checkbox change event.
i am using Datagridview control in C#, visual studio 2005.
Can some one help me out... pls urgent...
thanks in advance.
|
|
|
|
|
|
Hello All,
I hope this is the correct forum, please excuse me if it is not.
I am new to VS/C#. I have managed to make a simple service and MSI installer for it. What I need to do is make a change to the msi to read 3 command line arguments and record them in either the apps configuration file for the installed service or record them to the registry. If to the registry, I can change my service to read from it.
The installer project does not have an obvious code (*.cs) page, so I am unsure how to proceed.
Thanks!
cjoki
|
|
|
|
|
|
Thanks mark...I am reading material now and running the SDK download to get Orca. To bad MS does not have that in a separate download...oh well.
I will post my results later.
|
|
|
|