|
Hello everyone,I'm still migrating the VB to VB.NET Engine here.I am a beginner to VB.NET. I found this error message while I'm coding,can anyone give me a help please?
Overload resolution failed because no accessible 'New' can be called without a narrowing conversion: 'Public Sub New(selectCommandText As String, selectConnection As System.Data.SqlClient.SqlConnection)': Argument matching parameter 'selectConnection' narrows from 'System.Object' to 'System.Data.SqlClient.SqlConnection'. 'Public Sub New(selectCommandText As String, selectConnectionString As String)': Argument matching parameter 'selectConnectionString' narrows from 'System.Object' to 'String'.
And the following is my code>>
Private Sub Spam_Now()
Dim MemberDV As DataView
Dim i As Integer
Dim sql1, sql2, sql3 As String
'sql1 = "SELECT TOP 20 * FROM TT_Member WHERE Reminder = '0' AND Status = '1'"
ObAdapter1 = New SqlDataAdapter("SELECT TOP 20 * FROM TT_Mber WHERE Reminder = '0' AND Status = '1'", Obconn1) '<
|
|
|
|
|
drexler_kk wrote: Argument matching parameter 'selectConnectionString' narrows from 'System.Object' to 'String'.
You are passing a String parameter for an SQLConnection object. The argument you are passing must be an SQLConnection object and not String object.
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Thanks for your solution. Do you mean that I should change that line to the following?
ObAdapter1 = New SqlDataAdapter(Obconn1, "SELECT TOP 20 * FROM TT_Member WHERE Reminder = '0' AND Status = '1'")
ds1 = New DataSet
ObAdapter1.Fill(ds1, "MemberList")
I have try but it works,so I just want to reconfirm that is what you ask me to modified?
Thank you so much for the solution and effort.
Regards
Drexler
|
|
|
|
|
|
Yeah,thank you so much. I really learn from your advice. Good solution.
Regards
Drexler
|
|
|
|
|
hi,
i try to send an email with attachment, but when the program fails to send out the mail, i can't delete the file (the file i wish to attach in the mail) in my local drive, i think it is locked when i am trying to send, i have used the code below to delete the file
For Each sSubstr In attach_string.Split(delim)<br />
If System.IO.File.Exists(sSubstr) = True Then<br />
Try<br />
System.IO.File.Delete(sSubstr)<br />
'MsgBox("File Deleted")<br />
Catch ex As IOException<br />
Label1.Text = ex.Message<br />
Finally<br />
End Try<br />
End If<br />
Next
i didn't catch any exception while debuging but it fails to delete the file, when i go to the path (where i the file is) to delete the file manually, windows tells me "Canot delete File: Access is Denied. Make sure the file is not ful or write protected or currently in use". Any idea how to fix that?
-- modified at 23:23 Sunday 22nd January, 2006
|
|
|
|
|
|
thanks for your fast reply,
can i know how to close the open handles file, after i fail to attach a mail when executing
SmtpMail.Send(Message)
For example i am trying to do:
try<br />
SmtpMail.Send(Message)<br />
catch ex as exception<br />
' what should i do here to close the open handles file when i fail to attach?<br />
' then i fail to delete the attachment here<br />
finally<br />
end catch
Thanks
|
|
|
|
|
|
i have called the close method for file steam at the other place of my program but it still din work and the System.Web.Mail.SmtpMail does not have a close method,can u show me a simple piece of code on wht to write in the catch block when i fail to send the email?
<br />
try<br />
If attach_string <> "" Then<br />
For Each sSubstr In attach_string.Split(delim)<br />
Dim myAttachment As MailAttachment = New MailAttachment(sSubstr)<br />
Message.Attachments.Add(myAttachment)<br />
Next<br />
End If<br />
<br />
SmtpMail.Send(Message)<br />
catch ex as exception<br />
' what should i do here to close the open handles file when i fail to attach?<br />
finally<br />
end catch
|
|
|
|
|
Try Disposing the SmtpMail object before you try to delete the file. There is no other method to "force" the filehandle to be released.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
can you show me on how to dispose off the smtpmail object? because i couldn't find any dispose method or close there, thanks alot!
|
|
|
|
|
I'm sorry, it should have been the Message object, not the SmtpMail object.
Message.Dispose()
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I guess this one maybe a bit tough, but, does anyone know how to create a virtual com port? Or have any idea on how this can be done?
The aim is to create 2 ports with a virtual connection between them so that I can send data out one port for testing a program that recieves data from the other.
Thanks..
|
|
|
|
|
|
|
I want to access the "Data Link Property Layer" during runtime so that i could create a connection during deployment without editing the connection string value which is saved in a text file (which I usually do).
Anybody has an idea on how will i access Data Link Property and display it during run time?
|
|
|
|
|
thealca wrote: Data Link Property Layer
First of all, what are you calling a "Data Link Property Layer"?? You can't run any of your applications code in the middle of its installation. Any configuration options should be stored in the apps config file. Your installer should ask for different options, install the app, then modify the configuration file(s) of the app.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
"modify the configuration file(s) of the app."
I want this to be done in a GUI which is I thought It would be better if I can access the "Data Link Properties" GUI, from which I can select the Provider and the Data Source and save it to a file (might be .INI file or .XML file), so I don't have to edit the configuration file (app.config) file during deployment, which is also risky if you let somebody do the deployment because he might modify accidentally the other elements.
|
|
|
|
|
Are you talking about a dialog in the Visual Studio designer for setting the properties of a Connection object?
No, you can't get to it during the install. You have to provide some interface for this yourself.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Somebody know how to generate crystal report in vb.net programmatically!!!
I just want to know the codes on how to create a report from vb.net having a back-end ms access and using ado.net
|
|
|
|
|
i have also been trying to create crystal reports programatically like u. i s'pos what u mean is that u want to create a crystal report using the dataset u created and populated with data at runtime.
i think the only thing u can do is create the dataset by placing an apapter object from the toolbar. and populating the dataset using the fill method. then creating the report using that dataset.
if u want to do it programmatically i think u have to use temporary tables. wht i mean is u create a temp table in advance in your database then insert the data u want to display in the report at runtime. then create the report and display the data.(assume u know how to do it)
there is no other way to do it. i think. i have been trying it for some months now and i decided to finish the project i am doing the way i said. it works. so go ahead.
|
|
|
|
|
I have an existing vb.net application that runs on a local machine in our company. Currently, you must be at that machine in order to control it. I would like to add the ability to control some simple features from a browser on other machines on our intranet. However, I do NOT want to have to rewrite the application as an asp app or have it run on a web server. I also CANNOT break out the internal classes of this application into dlls.
Is it possible to *add* asp-type capabilities to this existing vb.net app? Any examples of a simple vb.net app doing so are appreciated.
|
|
|
|
|
smarr wrote: I would like to add the ability to control some simple features from a browser on other machines on our intranet. However, I do NOT want to have to rewrite the application as an asp app or have it run on a web server. I also CANNOT break out the internal classes of this application into dlls.
So are you saying that you want to create a web app that doesn't run on a web server ? Your other alternative is to write a web server. That is a/ a lot of work and b/ meaning you'll still be running on a web server.
smarr wrote: Is it possible to *add* asp-type capabilities to this existing vb.net app?
The way to do this is to reuse your business logic, and write an ASP.NET presentation layer. You'll need to 'break' internal classes into a new project, if you can't put them in a dll, you'll need to just copy them. The resultant app will, by definition, need to be on a web server.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I believe I understand what you are saying--that adding asp capabilities to an existing vb.net app is not trivial (or possible?) and the "guts" of the app will need to be moved into an asp.net application. Correct?
I can live with a web server, and could probably incorporate one into the machine which is running this app. However, the application is far too complex to be easily ported to an asp application (or any other type, for that matter). The core logic is deeply ingrained into the application and could not be moved (easily) into a dll.
|
|
|
|