469,626 Members | 1,062 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

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.
Feb 24 '06 #1
0 1042

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Douglas Harber | last post: by
1 post views Thread by NagaKiran | last post: by
reply views Thread by John Fleming | last post: by
reply views Thread by XML newbie: Urgent pls help! | last post: by
3 posts views Thread by Pakna | last post: by
reply views Thread by shamirza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.