Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old February 24th, 2006, 08:15 PM
XML newbie: Urgent pls help!
Guest
 
Posts: n/a
Default VB.Net: Accessing the database on the remote server thru Web Servi

I want to query the database located on the remote server(not on my network)
based on the time frame and tables selected by the user in the GUI.I have
created a reference to it's webservices. The results should be displayed on
the browser in a My first question, how should I do this.

In the webservice, the function is defined as:

Public Function ExportPositions(ByVal SessionID As String, ByVal
StartDateTime As Date, ByVal EndDateTime As Date,
<System.Xml.Serialization.XmlArrayItemAttribute("A ssetID",
IsNullable:=false)> ByVal AssetList() As Long) As Position()
Dim results() As Object = Me.Invoke("ExportPositions", New
Object() {SessionID, StartDateTime, EndDateTime, AssetList})
Return CType(results(0),Position())
End Function

Secondly, for testing purpose I did the following.Now, sinceTextbox2.Text
refers to the column AssetList in the table and there it is stored as an
Array of Long. Now, when I do
the following, I get an error stating strring cannot be converted to
arraytype long.

doc.LoadXml(EDP.ExportPositions(TextBox1.Text,
cmbStartDateandTime.SelectedText, cmbEndDateandTime.SelectedText,
Textbox2.Text))


If I take out (Textbox2.Text) from the above line , I get the message,
Argument not specified for the parameter AssetList.
I got this function from the net that converts string to an array:

Public Sub StringToArray(ByVal sThisString As String, ByVal asResults() As
Long, Optional ByVal sDelimRows As String = "ae", Optional ByVal sDelimCols
As String = "[] ")

Dim lPos1dDel As Long, lLenString As Long, lColSepLen As Long
Dim lLastPos As Long, lThisRow As Long, lNumCols As Long, lThisCol
As Long, lRowSepLen As Long

sThisString = strAsset.Text

lLenString = Len(sThisString)
If lLenString Then


lLastPos = 1
lPos1dDel = InStr(1, sThisString, sDelimRows)

'Dim StringCount As Integer 'The number of strings to output
'lNumCols = StringCount(sThisString, sDelimCols,
CompareMethod.Text)

lRowSepLen = Len(sDelimRows)

'If Not lNumCols Then
'Convert a 1D string
'Create buffer to store results
ReDim asResults(0 To Int(lLenString / 2) - 1)
'new
'ReDim asResults(lLenString - 1)
lPos1dDel = InStr(lLastPos, sThisString, sDelimRows,
CompareMethod.Text)
Do While lPos1dDel
lThisRow = lThisRow + 1
asResults(lThisRow) = Mid$(sThisString, lLastPos, lPos1dDel
- lLastPos)
lLastPos = lPos1dDel + lRowSepLen
lPos1dDel = InStr(lLastPos, sThisString, sDelimRows,
CompareMethod.Text)

Loop
ReDim Preserve asResults(0 To (lThisRow - 1))

'End If
'Else
'Erase asResults

End If

End Sub

This one also doesn't work.
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles