|
Hi Zac,
Thanks for reply.I am facing below mentioned error.
Please help me.
WSDL:
<xs:element name="BundleBalanceRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="Interface" type="tns:InterfaceSimpleType"/>
<xs:element name="MSISDN" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="BundleBalanceResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="ResponseCode" type="xs:integer"/>
<xs:element name="ResponseData">
<xs:complexType>
<xs:sequence>
<xs:element name="BundleBalanceDetails" type="tns:BundleBalanceDetailsComplexType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
Code:
Try
Dim wbService As New WEB_APIs_SCBF.Service
Dim ct_BundleBalanceDetails As WEB_APIs_SCBF.BundleBalanceResponseResponseData
Response.Write("Calling BundleBalanceRequest ")
Dim ResponseCode As String = wbService.BundleBalanceRequest(WEB_APIs_SCBF.InterfaceSimpleType.WEB, "03189719", ct_BundleBalanceDetails)
Response.Write(" BundleBalanceResponse ")
Response.Write(ResponseCode)
Catch ex As Exception
Response.Write(" API call is failed " & ex.Message)
Finally
End Try
Output:
Calling BundleBalanceRequest
API call is failed
There is an error in XML docuement (1,580).
dadsadasd
|
|
|
|
|
how to call SQL functions in Visual Basic 6.0
|
|
|
|
|
You don't. VB6 is deprecated and no new software is written in the language. It's no longer supported, and no longer sold.
There are quite some examples on how to do this using VB.NET, which is available for FREE.
If you "must" use VB6, you'll have to research yourself. The preferred way in VB6 was called ADO[^], but you could also use ODBC.
|
|
|
|
|
Hello,
I'm working on a project with a database. I'm taking the selected item from a databound Combobox and using the selected text to get a row from another table.
I'm using:
Microsoft Visual Basic 2008, Professional Edition
Here's the code:
sStringTemp2 = "Name = '" + sStringTemp + "'"
Dim tRow As DataRow() = tPlazimBases.Select(sStringTemp2)
When I set a watch for my row variable it shows it loaded the specific row from the table. But I'm unable to figure out how to put that row data in to text boxes or strings.
I'm not sure if when I did the 'select' function if that moved the selected row of the datatable to the row I'm looking for and I should then refer back to the datatable
or
If I should be using the tRow directly to get my information to load into form components
Any links or code samples would be appreciated!!
Thank you for any help!
|
|
|
|
|
Use your tRow variable:
txtName.Text = DirectCast(tRow("Name"), String)
or
txtName.Text = DirectCast(tRow(0), String)
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
Thank you for your help.
I tried your sample code but I still get and error, I've also tried tweaking is a few ways and I still get the following errors:
"Conversion from string "Name" to type 'Integer' is not valid."
"Value of type 'System.Data.Datarow' Cannot be converted to 'String'"
"Conversion from string "Name" to type 'Integer' is not valid"
Here is how I'm building my search string:
sStringTemp = CBPlazim.SelectedValue.ToString()
sStringTemp2 = "Name = '" + sStringTemp + "'"
CBPlazim is a Combobox that is displays the 'Name' column from the table I'm trying to 'pull' the row from.
It's pulling the right row in the second table. Like I mentioned above, I set a watch on the two string variables and when I have it stop before attempting to put the row somewhere, it's the right row.
Am I just going about finding the row I want in the second table wrong?
I've confirmed that the Column 'Name' in the table is a string variable
Do you know if when I'm using the search code, does it move the active record to the row I'm looking for?
modified 18-Nov-12 22:41pm.
|
|
|
|
|
Try this:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dt As New DataTable
With dt
.Columns.Add("Name")
.Columns.Add("Address")
.Columns.Add("Salary")
.Rows.Add(New Object() {"John", "123 Some Street", 1234})
.Rows.Add(New Object() {"Frank", "15 TheOther Street", 1400})
.Rows.Add(New Object() {"Harry", "3 No Street", 450})
End With
Dim dr As DataRow = GetDataRow(dt, "John")
Label1.Text = String.Format("Name = {0}{3}Address = {1}{3}Salary = {2}",
dr("Name").ToString, dr("Address").ToString, dr("Salary").ToString, vbCrLf)
End Sub
Private Function GetDataRow(ByVal dt As DataTable, ByVal name As String) As DataRow
Dim sStringTemp2 = "Name = '" + name + "'"
Dim tRow As DataRow() = dt.Select(sStringTemp2)
Return tRow(0)
End Function
Note that your tRow object is an Array; Dim tRow as DataRow() , so we returned the first result, you may need to iterate through the array if there ismore than one result returned from the Select method.
Hope this helps.
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
Thank you again.
I didn't use your example fully but finally figured out how to use the datarow I created by tweaking what you posted. I noticed you put tRow(0). I had been using that to try and access the elements. When I typed that from your example it gave me the option of .item and I tried that. Thanks again!
I used:
tRow(0).Item(15)
and that worked to access the element in the datarow!!!
|
|
|
|
|
JRHibner wrote: I noticed you put tRow(0).
I am glad it could help you.
Remember that tRow is an Array, and that tRow(0) returns tae first item in the array. Can you guarantee that there will only ever be one result from your search? If there could be more, you may need to loop through the array to get ALL the results.
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
I can guarantee there will only be one result. As the list for the drop down each item is the 'Name' column from the table. What I'm trying to do is use that rows data to enable/disable controls on the form. So I have to 'read' the Boolean variables associated with that 'Name'
|
|
|
|
|
Thanks again for all the help.
Your questions leads me to my next one. In the above example I'm using a value from one table to find the row in another and then load those values to a form. So in that example there will always be a value in the second table due to the way the data is saved.
Now when I save the row to the database, I want to check and see if the item already exists and if I should update it or save it as a new record.
I've been using the following code to search the table before saving to determine if I need to save it or update the record.
sStringTemp = "Item = '" & MTBGeneLabel.Text & "'"
Dim tRow() As DataRow = tPlazimorphGenes.Select(sStringTemp)
If tRow(0).Item(0) Is DBNull.Value Then
SaveItemRecord(uUniqueID)
Else
UpdateItemRecord(uUniqueID)
End if
I bolded the section that is giving me issues. Trying to test if the row exists or if it's Null. I've tried quite a few variations from tutorials and answers for similar questions I found online.
|
|
|
|
|
Check this out:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dt As New DataTable
With dt
.Columns.Add("Id")
.Columns.Add("Name")
.Columns.Add("Address")
.Columns.Add("Salary")
.Rows.Add(New Object() {1, "John", "123 Some Street", 1234})
.Rows.Add(New Object() {Nothing, "Sally", "26 This Street", Nothing})
.Rows.Add(New Object() {3, "Frank", "15 TheOther Street", 1400})
.Rows.Add(New Object() {4, "Harry", "3 No Street", 450})
End With
Dim dr As DataRow = GetDataRow(dt, "Sally")
Dim id As Integer = -1
If Not TypeOf (dr("Id")) Is DBNull Then
id = CInt(dr("Id"))
End If
Try
Label1.Text = String.Format("ID = {0}{4}Name = {1}{4}Address = {2}{4}Salary = {3}", id.ToString,
dr("Name").ToString, dr("Address").ToString, dr("Salary").ToString, vbCrLf)
Catch ex As Exception
End Try
Label2.Text = String.Format("Field 0 contains: {0}", dr(0).GetType)
If (TypeOf (dr("Id")) Is DBNull) Then
Label3.Text = "DBNull in Field 0"
End If
End Sub
Private Function GetDataRow(ByVal dt As DataTable, ByVal name As String) As DataRow
Dim sStringTemp2 = "Name = '" + name + "'"
Dim tRow As DataRow() = dt.Select(sStringTemp2)
Return tRow(0)
End Function
End Class
Notice that I used TypeOf to check the DataType in the Field and I used GetType() to return the Type.
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
I looked over the example. It's not quite my situation. In my case I'm generating a new record. I want to be able to check and make sure the Name isn't already used in the datatable. So when I go to save Information for 'Sally' it checks if there is a record for her. If there is a record her it will update that record. If there isn't a record for her it will save it as a new record.
Thanks again for your time and help
|
|
|
|
|
JRHibner wrote: I want to be able to check and make sure the Name isn't already used in the
datatable
In that case it sounds like you want to check whether a row is returned from the Select method?
If tRow.Count > 0 Then
Else
End If
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
So simple, so elegant. I'm completely overthinking that one. Thanks again!
|
|
|
|
|
Is it possible to change an external assembly's property using reflection; specifically the GUID? The reason I'm trying to do this is for when a customer logs into my website and purchases a plug-in for the application. The server would then change the GUID within the plug-in's DLL and then allow the custom to download it. When they then go to install the plug-in, the application check the assembly's GUID to see if it matches what it's supposed to. This is part of the security system I have designed (within my head at the moment) to ensure that the assembly is allowed to be used, and can only be used by that specific person. So is there anyway to change the GUID of an assembly through reflection?
Thanks
|
|
|
|
|
You can't make modifications using reflection; it's a read-only game. There are multiple ways to generate a new assembly; using the CompilerService[^] would be an option, but "modifying" an existing assembly would be easier using Mono's Cecil.
|
|
|
|
|
So if I understand correctly, based on my quick read of the link you provided, with the Mono's Cecil I could open up an assembly that I created, modify the GUID assembly attribute, and then save it to a new file and server it to the customer for download?
|
|
|
|
|
Yes
|
|
|
|
|
I am looking for an example of how to call MessageBeep in Visual Basic 8/net?
|
|
|
|
|
You can start with this[^].
And then move on to these[^].
Honestly, this was not very hard to find. You just Google for "MessageBeep VB.NET" and you come up with all kinds of examples.
|
|
|
|
|
Hi,
I am working on program to be used to process confidential data. That data must be well-encrypted. I have built method, that exports data from memory to XML, encrypts XMl document and saves it to file. But, what seems strange to me is, that encryption method doesn’t work. After its execution, file, which may contain encrypted data is created, but remains empty. I don’ t see any bug in the code. Could you help me to get it working, please?
Here is code used to encrypt and save XML.
Public Sub Save(ByVal carrier As DataCarrier, ByVal password As String, ByVal filename As String)
Try
Using sha As New SHA512Managed
Dim salt As Byte() = sha.ComputeHash(Encoding.Default.GetBytes(password))
Using pdb As New Rfc2898DeriveBytes(password, salt), aes As New RijndaelManaged, filestr As New FileStream(filename, FileMode.Create, FileAccess.Write)
Using cryptostr As New CryptoStream(filestr, aes.CreateEncryptor(pdb.GetBytes(32), pdb.GetBytes(16)), CryptoStreamMode.Write)
ExportData(carrier).Save(cryptostr)
End Using
End Using
End Using
Catch ex As Exception
Logging.Instance.WriteException(ex, TraceEventType.Error)
MessageBox.Show(String.Format(My.Resources.UnhandledExceptionExString, ex.Message, ex.ToString), My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Also, is that encryption algorithm OK, or there is some way to break it? I must be sure that there is no way to break encryption, that is used.
Stanislav Husár
|
|
|
|
|
Have you tried putting a breakpoint to see if an Exception is thrown?
After a brief glance, the code itself looks fine AFAICT, though the problem could be in the ExportData method, is there a reason you aren't calling the cryptostream's Write directly?
My knowledge about this is four years out of date, but Rijndael was considered secure. I vaguely recall reading they'd found a way to crack it in theory, but applying the crack it in practise hasn't happened yet and isn't likely to be feasible soon.
|
|
|
|
|
It does not throw any exception.
ExportData method only creates XML document with data to be encrypted. I have checked, that result of ExportData contains, what it should cotain.
I have also tried following, again, empty file is generated.
Public Sub Save(ByVal carrier As DataCarrier, ByVal password As String, ByVal filename As String)
Try
Using sha As New SHA512Managed
Dim salt As Byte() = sha.ComputeHash(Encoding.Default.GetBytes(password))
Using pdb As New Rfc2898DeriveBytes(password, salt), aes As New RijndaelManaged, filestr As New FileStream(filename, FileMode.Create, FileAccess.Write)
Using cryptostr As New CryptoStream(filestr, aes.CreateEncryptor(pdb.GetBytes(32), pdb.GetBytes(16)), CryptoStreamMode.Write)
Dim str = ExportData(carrier).ToString()
Using w As New StreamWriter(cryptostr)
w.Write(str)
End Using
End Using
End Using
End Using
Catch ex As Exception
Logging.Instance.WriteException(ex, TraceEventType.Error)
MessageBox.Show(String.Format(My.Resources.UnhandledExceptionExString, ex.Message, ex.ToString), My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Moreover, I have tried simply writing string literal to CryptoStream , this approach generates empty file too.
Strange is, that when I run this version:
Public Sub Save(ByVal carrier As DataCarrier, ByVal password As String, ByVal filename As String)
Try
Using sha As New SHA512Managed
Dim salt As Byte() = sha.ComputeHash(Encoding.Default.GetBytes(password))
Using pdb As New Rfc2898DeriveBytes(password, salt), aes As New RijndaelManaged, filestr As New MemoryStream()
Using cryptostr As New CryptoStream(filestr, aes.CreateEncryptor(pdb.GetBytes(32), pdb.GetBytes(16)), CryptoStreamMode.Write)
ExportData(carrier).Save(cryptostr)
Dim str = New String(Encoding.Default.GetChars(filestr.ToArray()))
Debugger.Break()
End Using
End Using
End Using
Catch ex As Exception
Logging.Instance.WriteException(ex, TraceEventType.Error)
MessageBox.Show(String.Format(My.Resources.UnhandledExceptionExString, ex.Message, ex.ToString), My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Then at Debugger.Break statement str variable cotains data, which should be in the file.
While this and simmilar solutions generate empty file.
Public Sub Save(ByVal carrier As DataCarrier, ByVal password As String, ByVal filename As String)
Try
Using sha As New SHA512Managed
Dim salt As Byte() = sha.ComputeHash(Encoding.Default.GetBytes(password))
Using pdb As New Rfc2898DeriveBytes(password, salt), aes As New RijndaelManaged, filestr As New MemoryStream()
Using cryptostr As New CryptoStream(filestr, aes.CreateEncryptor(pdb.GetBytes(32), pdb.GetBytes(16)), CryptoStreamMode.Write)
ExportData(carrier).Save(cryptostr)
File.WriteAllBytes(filename, filestr.ToArray())
Debugger.Break()
End Using
End Using
End Using
Catch ex As Exception
Logging.Instance.WriteException(ex, TraceEventType.Error)
MessageBox.Show(String.Format(My.Resources.UnhandledExceptionExString, ex.Message, ex.ToString), My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
I am really confused on what it does.
|
|
|
|
|
I'm not surprised at your confusion. The only thing I can suggest is to simplify as far as possible and re-factor back to what you want.
- Comment out the export line and perform the crypto-stream write directly.
- Create two byte arrays for the key and IV and make sure
pdb is creating a sensible key & IV, I would have thought that the if these were incorrect the encryption algorithm would throw. I've not used the derived bytes thing, so it is new to me - If the above isn't working, hard-code the key and IV byte arrays
If all else fails, you could go back to square one, and write a console app that uses hard-coded byte arrays.
|
|
|
|
|