How i can use ODP tool for oracle connection while working with VB.NET web service in the following web service in order to retrieve data from an oracle? The query that I would like to use is
SELECT ALIQUOT_ID FROM ALIQUOT
<%# WebService Language="vb" Codebehind="Aliquot.asmx.vb" Class="Aliquot" %>
Imports System.Web
Imports System.Data
Imports System.Web.Services
Imports Oracle.DataAccess.Client
Imports System.Type
Imports System.Web.Services.Protocols
Imports System.Configuration
Imports System.Configuration.ConfigurationManager
<WebService([Namespace]:="http://myservices.com/webservices/")> _
Public Class Aliquot
Inherits System.Web.Services.WebService
<WebMethod(Description:="Get Aliquot_IDs from Aliquot table")> _
Public Function GetAliquot_ID(ByVal aliquot_id As Integer) As Integer
Return (aliquot_id)
End Function
End Class
Related
This code is giving an error : type capture not defined
Imports Emgu.Cv
Imports Emgu.Cv.UI
Imports Emgu.Cv.Structure
Public class Form 1
Dim webcam as New capture
I was expecting it to create a new capture object
This is my part of code:
Imports System
Imports System.IO
Imports System.Threading.Tasks
Imports Proxies
Imports Services
Imports Settings
Imports Microsoft.Extensions.Configuration
Imports Microsoft.Extensions.DependencyInjection
Imports Microsoft.Extensions.Logging
Public Class Program
Private Shared _serviceProvider As IServiceProvider
Private Shared _configuration As IConfigurationRoot
Private Shared _logger As ILogger
Private Shared Sub SetupConfiguration(ByVal environment As String)
_configuration = New ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile($"{environment}.settings.json", [optional]:=True, reloadOnChange:=True).AddEnvironmentVariables().Build()
End Sub
Private Shared Sub SetupServiceProvider()
Dim serviceCollection As IServiceCollection = New ServiceCollection()
serviceCollection.AddSingleton(_configuration)
Program.ConfigureServices(serviceCollection)
_serviceProvider = serviceCollection.BuildServiceProvider()
_logger = _serviceProvider.GetRequiredService(Of ILogger(Of Program))()
End Sub
Private Shared Sub ConfigureServices(ByVal services As IServiceCollection)
services.AddLogging(Function(opt) opt.AddConsole())
services.AddMemoryCache()
services.Configure(Of AuthorizationSettings)(Function(s) _configuration.GetSection(NameOf(AuthorizationSettings)).Bind(s))
services.Configure(Of ServicesSettings)(Function(s) _configuration.GetSection(NameOf(ServicesSettings)).Bind(s))
services.AddSingleton(Of ITokenService, TokenCacheService)()
services.AddSingleton(Of IIdentityServiceProxy, IdentityServiceProxy)()
services.AddSingleton(Of IIdentityImportService, CsvIdentityImportService)()
End Sub
End Class
I got the error in these two lines and do not let me compile:
services.Configure(Of AuthorizationSettings)(Function(s) _configuration.GetSection(NameOf(AuthorizationSettings)).Bind(s))
services.Configure(Of ServicesSettings)(Function(s) _configuration.GetSection(NameOf(ServicesSettings)).Bind(s))
The error I got is this:
BC30491: Expression does not produce a value
Any ideas on how to fix it?. I use this code to connect to an API using OAuth 2.0 and JSON Web Token (JWT) AuthorizationSettings and ServiceSettings are two classes which return configuration. This code was converted from a C# code
i have a web API project to be consumed from mobile applications and i was trying to make a file upload controller. there are few resources in C# and i don't find anything useful for VB.NET.
i tried this code below converting from c# to VB.NET, but says "Move is not a member of MultiPartFileData".
Imports System
Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Imports System.Net
Imports System.Net.Http
Imports System.Threading.Tasks
Imports System.Web
Imports System.Web.Http
Namespace HelloWorld.Controller
Public Class FileUploadingController
Inherits ApiController
<HttpPost>
<Route("api/FileUploading/UploadFile")>
Public Async Function UploadFile() As Task(Of String)
Dim ctx = HttpContext.Current
Dim root = ctx.Server.MapPath("~/App_Data")
Dim provider = New MultipartFormDataStreamProvider(root)
Try
Await Request.Content.ReadAsMultipartAsync(provider)
For Each file In provider.FileData
Dim name = file.Headers.ContentDisposition.FileName
name = name.Trim(""""c)
Dim localFileName = file.LocalFileName
Dim filePath = Path.Combine(root, name)
File.Move(localFileName, filePath)
Next
Catch e As Exception
Return $"Error: {e.Message}"
End Try
Return "File uploaded!"
End Function
End Class
End Namespace
That error message means the compiler think that you are trying to call a method from the MultiPartFileData class. The variable of type MultiPartFileData is the one called file (notice the lowercase) initialized in the For Each loop.
Instead you want to call the Move method from the System.IO.File class (notice the uppercase).
VB.NET services (always running in background looking to catch errors while you type) is case insensitive so, for it, the two names are the same and here arises the error emitted when you code that line.
The best solution is to avoid names like file for your variables when you plan to use the class System.IO.File. Otherwise you could simply add the full qualified method's name in this way
System.IO.File.Move(localFileName, filePath)
I'm getting this (Dts is not declared) exception when I try to build my SSIS script task. Any idea how to resolve it?
here is the part of my code
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Public Class ScriptMain
Public Sub Main()
Try
Dim cm As ConnectionManager = Dts.Connections.Add("FTP")
cm.Properties("ServerName").SetValue(cm, Dts.Variables("SFTPServerName").Value.ToString)
cm.Properties("ServerUserName").SetValue(cm, Dts.Variables("SFTPLogin").Value.ToString)
cm.Properties("ServerPassword").SetValue(cm, Dts.Variables("SFTPPassword").Value.ToString)
cm.Properties("ServerPort").SetValue(cm, Dts.Variables("SFTPPortNumber").Value.ToString)
This worked for me:
Add Your_Variable in the script component. (Right click --> Edit --> Script --> ReadOnlyVariables).
Dim variableString As String = Me.ReadOnlyVariables("User::Your_Variable").Value.ToString().
Try adding;
Imports Microsoft.SqlServer.Dts
Try me.Connections and me.Variables
I have a MVC3 application which uses Devexpress controls.
My first page works fine, but this is not strongly typed.
I get the error "BC30451: 'ViewData' is not declared. It may be inaccessible due to its protection level" on my second page which starts with:
#ModelType IEnumerable(Of MyModel.XXX)
#Code
ViewBag.Title = "Index"
End Code
<h2>Index</h2>
The resulting vb code inherits from System.Web.Mvc.WebViewPage.
Is there a problem with the imports???
#ExternalChecksum("C:\Work\XXX\Views\FahrzeugMarke\Index.vbhtml","{406ea660-64cf-4c82-b6f0-42d48172a799}","A585D67D9E053939A220E5FDCF169863")
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.235
'
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Imports DevExpress.Utils
Imports DevExpress.Web.ASPxCallbackPanel
Imports DevExpress.Web.ASPxClasses
Imports DevExpress.Web.ASPxEditors
Imports DevExpress.Web.ASPxGridView
Imports DevExpress.Web.ASPxHtmlEditor
Imports DevExpress.Web.ASPxMenu
Imports DevExpress.Web.ASPxNavBar
Imports DevExpress.Web.ASPxPopupControl
Imports DevExpress.Web.ASPxRoundPanel
Imports DevExpress.Web.ASPxSpellChecker
Imports DevExpress.Web.ASPxSplitter
Imports DevExpress.Web.ASPxTabControl
Imports DevExpress.Web.ASPxTreeView
Imports DevExpress.Web.ASPxUploadControl
Imports DevExpress.Web.Mvc
Imports DevExpress.Web.Mvc.UI
Imports MvcMiniProfiler
Imports System
Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Imports System.Net
Imports System.Web
Imports System.Web.Helpers
Imports System.Web.Mvc
Imports System.Web.Mvc.Ajax
Imports System.Web.Mvc.Html
Imports System.Web.Routing
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.WebPages
Namespace ASP
Public Class _Page_Views_FahrzeugMarke_Index_vbhtml
Inherits System.Web.Mvc.WebViewPage(Of IEnumerable(Of myModel.XXX))
Public Sub New()
MyBase.New
End Sub
Protected ReadOnly Property ApplicationInstance() As ASP.global_asax
Get
Return CType(Context.ApplicationInstance,ASP.global_asax)
End Get
End Property
Public Overrides Sub Execute()
WriteLiteral(""&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10))
#ExternalSource("C:\Work\XXX\Index.vbhtml",3)
ViewBag.Title = "Index"
I think I solved the problem:
I created the view with MvcScaffolding and the file was saved with ANSI encoding. However, there were German umlauts in my model class name and these got corrupted.
Changing the file encoding to UTF8 solved the issue...