Click here to Skip to main content
14,739,661 members

Comments by Alan Tuscano (Top 113 by date)

Alan Tuscano 17-Jul-13 3:15am View
Reason for my vote of 5 \n code so simple yet "powerful"
Alan Tuscano 7-Feb-13 1:05am View
Thanks SA..
Alan Tuscano 22-Jan-13 21:25pm View
Hi SA,
I've done the code and run it.

regKey1.SetValue("", "", 0)

But in the registry, the value for default becomes empty/no value.
Alan Tuscano 16-Jan-13 22:43pm View
Thanks phil.o, its working!
Alan Tuscano 26-Dec-12 20:07pm View
Hi VitorHugo,

I'm using windows XP in my PC and Office 2003 for my xls reference. Will I need to download 2007 PIA for me to copy/saveas the xlsx file to xls format?

will it not do conflication in the 2003 PIA which is in my computer and is being use by my program ?
Alan Tuscano 19-Dec-12 0:43am View
Hi Garth,

I may have found the root of the problem.

the original file is from excel and is converted into datatable. see code below:

Dim sr As New StreamReader(path)

Dim fullFileStr As String = sr.ReadToEnd()



Dim lines As String() = fullFileStr.Split(ControlChars.Lf)

Dim recs As New DataTable()

Dim sArr As String() = lines(0).Split("~"c)

For Each s As String In sArr

recs.Columns.Add(New DataColumn())


'recs.Columns.Add(New DataColumn())

Dim row As DataRow

Dim finalLine As String = ""

For Each line As String In lines

row = recs.NewRow()

finalLine = line.Replace(Convert.ToString(ControlChars.Cr), "")

row.ItemArray = finalLine.Split("~"c)



from this process, the date value is converted in numeric 40939 from its original excel format of 20120131.

How can I convert the date column to date format when converting into datatable using the same code above?
Alan Tuscano 19-Dec-12 0:13am View
I'm wondering, where should get Spire?
Alan Tuscano 18-Dec-12 22:27pm View
Hi CandyT,

here's my code;

For Each dr As DataRow In MegaTxt.Rows

Dim provider As CultureInfo = CultureInfo.InvariantCulture

Dim oChkDate As Date = Date.ParseExact(dr(2).ToString, "DD/MM/YY", provider)


dr(2).ToString -- > date row formated "10/12/12"
Alan Tuscano 11-Dec-12 21:53pm View
I've got it correct CandyT, but thanks for the big help.
Alan Tuscano 11-Nov-12 21:19pm View
Hi SA,

Actually, its still in the drawing board as discussions bout a url accessing sftp sites to load and download files. We are thinking if thats possible that is why i ask? if its not then we'll do another planning.

Thanks Anyway!
Alan Tuscano 27-Sep-12 1:06am View
Hi Kuthuparakkal,

I use WINscp or FileZilla to access the remote "path/directory". I've tried Directory.Exists and it can't locate such "path/directory" in the remote server.
Alan Tuscano 12-Jul-12 22:04pm View
Hi SA,

Finally got Access, Upload and Download files from SFTP.

Alan Tuscano 10-Jul-12 3:56am View
Hi Sergey,

I can Access SFTP Server/Folder using winscp.. can you please help me and provide sample code on how to upload/download textfile to the sftp server using winscp.

I really have no idea how to do it/...

Thanks a lot..
Alan Tuscano 9-Jul-12 21:40pm View
Hi Sergey, Thanks for the quick reply.

searching the web for winscp sftp.. i am always being directed to "PuTTY"? and PuTTY is a 3rd party software(Free).

I haven't check the links you provide, but.. can Winscp alone do the work or i will need to download and use 3rd party software like "PuTTY"?
Alan Tuscano 3-May-12 22:02pm View
Hi Losmac,

Sub UnZip()
Dim sc As New Shell32.Shell()
Dim output As Shell32.Folder = sc.NameSpace("C:\eSOA\")
Dim input As Shell32.Folder = sc.NameSpace("c:\eSOA\")
output.CopyHere(input.Items, 4)

End Sub = 343,893 KB = 3,011,109 KB

Above, i tested and it extracted the file.
When i tested, did not extracted the file, Instead give this error "Object reference not set to an instance of an object."

Inside contains .pdf files.
Inside contains sub folders.

What and where is the error? I Can't locate it? Please Help Me.
Alan Tuscano 3-May-12 4:17am View
I got the program running on testing because i'm using a single zipped folder, and contains all the records i need to validate.

but now, a new criteria was submitted, and inside the zipped folder, consists of sub folder and sub folder from the sub folder and then the record.

I'm using shell32 function to download the the zipped file,
Alan Tuscano 25-Apr-12 0:04am View

I have no idea why they'd still compile the project when its already build. At first, i was thinking that they review the codes that is why they ask for the project folder, but then, what they do is only to re compile the project and in win7 platform.
Alan Tuscano 25-Apr-12 0:00am View
Endeed SA,

I've prefer using SharpZipLib, its just that my PM persists using winzip. Though I have create a fucntion using sharpziplib, I wanted to create another using Winzip. I'll just assign a flag in my config, so that i can select what function to call if winzip does not exist in the user's pc.

Alan Tuscano 16-Apr-12 21:17pm View
This is great.

I need this,(to check if winzip is running and compressing) because my program, extracts file from a ftp server to my local drive, selects the files needed and transfers selected file to a new folder which then will be compresssed via winzip, after compression, the source folder and its files will be deleted.

here's the flow;
console.writeline("Searching files.. Please wait.!")
copyTOfolder() - this will copy selected files form source folder
Console.writeline("Compressing Folder....")
compressedVIAwinzip() - compresses the target folder
Console.Writeline("Uploading Zipped Folder to FTP....")
Console.Writeline("Removing unselected files from Local Drive!...")

From the code above, after selecting files and transferring it to the target folder, cursor then moves to compressing the target folder, then cursor again moves to Uploading then will move to Removing the unselected files to which, in less than 10 seconds, console will close leaving winzip still running and compressing the target folder.

What I need to do is for the cursor to wait for winzp to finish compressing before doing the next process. How??
Alan Tuscano 16-Apr-12 2:05am View
Hi SA,

I'm using winzip...

What i want to know is how to make my console visible when Winzip compresses the files i've extracted from other folder.
Alan Tuscano 15-Apr-12 20:45pm View
Yes Its Office XP pia, I've browsed google for answers on what to use when running a lower version of office in windows 7 and answers always points to oxppia download.

I've developed the program in Windows XP xp2, using Office 2002 in my excel automation(Office 2002 is the version installed in this workstation i'm using).

I've tested the program in other pc's using Windows XP sp3 as OS and office 2003 and or Office 2007 and my program works well.

Only when the QA Team copied the whole program and compiles it in a Windows 7 OS with Office 2007 that i got error having compatibility issue with the program Office2002 version. So, i resulted in downloading OXPPia but when i tried to install it in the windows7 pc, got error "Unable to continue Installation. Missing files".. I tried 3 times downloading OXPPia but repeatedly got the same error trice.
Alan Tuscano 4-Apr-12 4:40am View
my 5
Alan Tuscano 3-Apr-12 21:15pm View
Here's a much better code.

For i As Integer = 0 To _dtCol.Rows.Count
Dim nAcctNo As String = String.Empty
nAcctNo = _dtCol.Rows(i).Item(0).ToString

If nAcctNo <> String.Empty Then
Dim AcctNo As String = nAcctNo & "_JAN12.Pdf"
Dim sPath As String = AppSettings.Get("UnZipDir")
Dim tPath As String = AppSettings.Get("ZipDir")

'Test Account number : 100183500018
'nAcctNo : Test Account Number
'Test Month and Year : _JAN12
'File Format : pdf
'sPath : "C:\eSOA\Unzip"
'tpath : "C:\eSOA\Newzip"
'Above test values is existing, the filename, source and target dir.
'At Step by step debug, this is the source path and file
Dim nRec As String = sPath & "\" & AcctNo '--> C:\eSOA\Unzip\100183500018_JAN12.pdf"
'At Step by Step debug, this is the Target path and filename
Dim tRec As String = tPath & "\" & AcctNo
'At step by step debug, when i reach this line below
'it doesn't go inside this loop,
If Dir(nRec) <> "" Then
MsgBox("File exists")
'This will copy the above test values to the target directory(folder)
System.IO.File.Copy(nRec, tRec, True)

End If

'But when I tried this,
If Dir("C:\eSOA\Unzip\100183500018_JAN12.pdf") <> "" Then
MsgBox("File exists")
'Record was successfully copied to target directory
System.IO.File.Copy("C:\eSOA\Unzip\100183500018_JAN12.pdf", tRec, True)

End If

End If
Next i

As for the row count, i would have a different error "Index out of bound" or something like that. so, row count is not my problem.
Alan Tuscano 3-Apr-12 5:06am View
the situation is, I'll be copying records(pdf) from Unzip folder to Newzip folder, that will go with a validation on what filename from Unzip folder is to be cpied to Newzip folder.

I've tried copying 100001600019_JAN12.pdf(real file) into my Drive C:\,
Drive C:\100001600019_JAN12.pdf and tested it and if was successfully copied into Newzip folder,

But when i tried this, "C:\eSOA\Unzip\100001600019_JAN12.pdf "
error "File not found." appears.
Alan Tuscano 3-Apr-12 4:53am View
Hi OriginalGriff,
The error is "File not Found.!"
from the code below, i've tried analysing it over and ver but can't see the problem, yet it still throw an error.

If nAcctNo <> String.Empty Then

Dim AcctNo As String = nAcctNo & "_JAN12.pdf"
Dim sPath As String = AppSettings.Get("UnZipDir")
Dim tPath As String = AppSettings.Get("ZipDir")

Dim nRec As String = sPath & "\" & AcctNo
-- sample nRec is "C:\eSOA\Unzip\100001600019_JAN12.pdf
Dim tRec As String = tPath & "\" & AcctNo
-- sample tRec is "C:\eSOA\NewZip\100001600019_JAN12.pdf

If Dir(nRec) <> "" Then ----------->>>>>>> RECIEVE ERROR HERE "File not found."

System.IO.File.Copy(nRec, tRec, True)

End If

End If
Alan Tuscano 1-Apr-12 23:17pm View

I copied the whole folder of the project to the other pc. It does have a Visual Studio 2003 and 2005. My VS version is 2005.
Alan Tuscano 22-Mar-12 2:12am View
Thanks Sanit. It worked!
Alan Tuscano 20-Mar-12 20:09pm View
Hi Bert,

Actually, its a spreadsheet.

I've think about it, though haven't tried yet, I downloaded oxppia, its the assembly for Office 2002. I will try to install this assembly in the test pc with Windows 7 and Office 2007 environment.

Let you know if i'm successfull, otherwise, I will recompile my project using Office 2007.

Thanks Bert.
Alan Tuscano 19-Mar-12 22:59pm View
hi Dave,

here's a sample of the encrypted password "YaGCdU8x0Ft+bWpjfeyhig=="
if decrypted, its Nsel2009.
Alan Tuscano 15-Mar-12 10:25am View
Thanks Gregory.
I was having a discussion with some colleagues regarding this topic and most of them says that it can be decrypted.
Thanks again.
Alan Tuscano 14-Mar-12 4:04am View
Yes, I will!
Thanks again SA. :)
Alan Tuscano 14-Mar-12 3:02am View
Hi SA,
Thank You, got it running. Its a namespace, I add the FTPClient to the reference.

Thank you.
Alan Tuscano 13-Mar-12 10:10am View
Hi Dave and thank you for the reply.

Yes, ftp://filetransfer/testarea/cms/support/download/stmt exist.

I can access that path, and drag a file in it.
But inside my console program, which generates the excel workbook, and uploads that generated excel report, this error;

The remote server returned an error:(550) File unavailable

still appears.I'd been in circle with this error for 2 days. :(
Alan Tuscano 12-Mar-12 20:25pm View
Hi Bernhard,

That was also the problem, actually, its d main problem, I can't upload the Excel File unto the FTP Server.

I can access the Ftp Server, I tried dragging a file into it
<pre lang="vb">ftp://filetransfer/testarea/cms/support/download/stmt</pre> and I can. I opened the file i drag at the ftp server and i can view its contents. only when i run my program, generate a excel report and upload it at the FTP server that i can't upload the Excel report.
Alan Tuscano 12-Mar-12 4:19am View

I got this error after removing the last backslash "/"

The error appears between this lines:
Dim bFile() As Byte = System.IO.File.ReadAllBytes(oSAveAsDir)
Dim clsStream As System.IO.Stream = clsRequest.GetRequestStream()

The Remote Server returned an error: (550) File unavailable(e.g., file not found, no access)

oSaveAsDir is "c:\target\CMS_WISE06032012.xls"

I check the file, its in the destination folder when i save it after generating via excelAppWB.Saveas().

I also exited
excelAppWB = nothing
excelApp.quit after saving.
Alan Tuscano 11-Mar-12 20:43pm View
Hi SA,

Here the Code,

Imports System.IO
Imports System
Imports System.Data
Imports System.Net.FtpWebRequest
Imports System.Configuration
Imports System.Configuration.ConfigurationManager

Private Function CreateFTPFile(ByVal FileName As String, _
ByVal ServerName As String, ByVal UserID As String, _
ByVal Password As String, ByVal FTPFolderName As String, _
ByVal UploadedFileDirectory As String, ByVal FTPFileName As String) As String

FTPFileName = FTPFileName & FileName '& ".xls"
Dim FPTWriter As New StreamWriter(FTPFileName, True)
FPTWriter.WriteLine("open " & ServerName)
FPTWriter.WriteLine("cd " & FTPFolderName)
FPTWriter.WriteLine("put """ & UploadedFileDirectory & FileName & """")
Return FTPFileName
Catch ex As Exception
msg = "Function:CreateFTPFile - " & ex.Message
Throw New Exception(msg)
End Try
Catch ex As Exception
msg = "Function:CreatetxtFile - " & ex.Message
Throw New Exception(msg)
End Try
End Function

Yes, I did compare the uploaded and the original document.

Thanks in advance SA.
Alan Tuscano 11-Mar-12 4:01am View
Hi SA,

Thank you.. but my new problem is, when the uppoad is done, I checked the Excel file, and the workbook was empty?
Alan Tuscano 8-Mar-12 21:40pm View
There's Microsoft.Office.Interop.Excel

its the only reference with "Office".
What should I Add?
Alan Tuscano 8-Mar-12 19:26pm View
Thanks ProEnggSoft, It Worked! :)
Also, my 5 to u.
Alan Tuscano 6-Mar-12 19:21pm View
Hi Jyothikarthik_N,

As what you said sir,

<pre lang="vb">
Imports System.Data.OracleClient
Imports System.Configuration.ConfigurationSettings

Public Class DBConnection Dim _Conn As System.Data.OracleClient.OracleConnection

Public Function OracleConString() As String
Return "Data Source=" & ConfigurationManager.AppSettings("DataSource") & _ ";
"User ID=" & ConfigurationManager.AppSettings("DBUserID") & _ ";
Password=" & ConfigurationManager.AppSettings("DBPassword") & ";"
End Function
End Class</pre>

As what i noticed sir, there is no "ConfigurationManager" in the reference.

Imports System.ConfigurationManager ?

I'm using VS 2008, from my understanding, ConfigurationSettings is used in VS 2003, I just couldn't make way in doing it in VS 2008.
That is probably the reason why VS 2008 is sending me the warnings?
Alan Tuscano 6-Mar-12 4:09am View
sorry bout that Tejas,

but i think, the problem was my connection to oracle.. got this solve already.. got this new warning regarding "appsettings"..
the warning is;

'Public Shared ReadOnly Property AppSettings() As System.Collections.Specialized.NameValueCollection' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings'.

below is my connection

Imports System.Data.OracleClient
Imports System.Configuration.ConfigurationSettings

Public Class DBConnection

Dim _Conn As System.Data.OracleClient.OracleConnection

Public Function OracleConString() As String
Return "Data Source=" & AppSettings("DataSource") & _
"; User ID=" & AppSettings("DBUserID") & _
"; Password=" & AppSettings("DBPassword") & ";"

End Function

End Class
Alan Tuscano 2-Mar-12 1:24am View
I tried this in the SQL Editor(TOAD) and giving me a 0 result, but in the schema browser, i can see the tables, views, procs.

select *
from all_objects
where object_type in ('TABLE','VIEW')
and object_name = 'OBJECT_NAME';
Alan Tuscano 2-Mar-12 1:19am View
Hi Abhinav,

I'm Using TOAD. Forgot to say it yesterday. I'm Sorry.

Anyway, I can view tables, views, procs now.

Thanks for the Help. :)
Alan Tuscano 21-Feb-12 7:52am View
Hi Arun,

Yes, its SQL Server 2005. in my testing, i've installed in SSMS to 5 pc to test sp_addlinkedserver, it executed successfully, run my apps, worked okay.. i switched from server to server just to verify if the linked server is doing okay.. and its doing very good, even testing my apps.

I tried doing sp_linkedserver in the pc where i test my apps.
Alan Tuscano 19-Feb-12 22:39pm View
Hi Dave,

I'm running my apps(or have developed my apps) on a 32bit CPU. We've installed the apps on a Windows 2008 server, 64 bit windows.. and its running, we got a little of lost, trying to find the registry I created when we stamble on "Wow6432Node" and from there on, has been testing the apps.

Thank You so much Dave for the Help. :)
Alan Tuscano 17-Feb-12 1:27am View
The excel spread sheet was use only for displaying the records, no excel functions was use. I also generated a PIA. If i'm not mistaken, I included PIA in the creation of a Setup of my application.
Alan Tuscano 16-Feb-12 3:15am View
am sorry, i don't know how to do that?
Alan Tuscano 12-Feb-12 22:53pm View
Hi Ganesan,

I was searching for resources.resx and accidentally right click on app.config, i tried looking for version= and found none, i then run the program and now, seems its fine.. the error popping out is gone..

what happened in there?
Alan Tuscano 9-Feb-12 22:58pm View
Thank You Dave. :)
Alan Tuscano 9-Feb-12 4:38am View
Hi, Rakesh.. could not understand?
Alan Tuscano 9-Feb-12 4:37am View
But i have resolved the "remote server" error, as i'm testing another module that needs the linked servers.
Alan Tuscano 9-Feb-12 3:58am View
i tried running

SQLCMD -E -dMBMIS -iC:\mbkSCRIPTS\KR_REPORTS_manual_insert_script.sql

in the command prompt and got this error;

HResult 0x2, Level 16, State 1
Named Pipes Provider: could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occureed while establishing a connection to the server.
When connecting to SQL SERVER 2005, this failure may be caused by the fact that under the default settings
SQL server does not allow remote connections.
Sqlcmd: Error: Microsoft Sql Native Client : Login timeout expired.

I'm testing batch file in my Local Server named DEVELOPER04
Alan Tuscano 7-Feb-12 20:43pm View
Hi Chris,
I have hard time understanding this(just a newbie in doing this).

Above is a tables,
I created a script of this(in SSMS, right click on the table, SCRIPT TABLE, CREATE TO)

Above is a Stored Procedures,
I created a script of this(in SSMS, right click on the SP, SCRIPT STORED PROCEDURE, CREATE TO)

I don't know to refer or call above mentioned,

In the CD Installation Package that I will do, above "Scripts" is included together with the VB Application and other Required Components.

When The User loads and run the CD, Set Up will commence, after Installing the Application and components, installation will proceed by
Reading the "Scripts" or "SP", Create it in the DB and Execute It.

How will I do the Read, Create, Execute in SSMS without the user knowing what is happening inside the installation.
Alan Tuscano 7-Feb-12 2:28am View
Hi Raimis9,

Got it solved.. hehehe.. :)

I did tested it with 600 and with 0 and both run okay, but I will prefer using 0 as its infinite/unlimited.. :)

Thanks Raimis9. :)
Alan Tuscano 6-Feb-12 22:24pm View
Hi Chris,

Where will I put this code? I mean, where shall i write this code?
Alan Tuscano 1-Feb-12 19:48pm View
Naerling. Got your code working. Tnx.. I also got my program to run on other computer.. many tnx too all that shared in helping me. Tnx.. :)
Alan Tuscano 1-Feb-12 2:57am View
Hi Naerling,
forgot to detail textbox6.. :)
It will only be used when User selects the report that will create Excel spreedsheet, and the value from the textbox is the Exchange rate.

I'll try your code and get back to you soon.
Alan Tuscano 1-Feb-12 2:54am View
Hi Rajesh, why can't i do that stuff.. i tried making it into vb code, tried making it into bold but nothing has change. And U simply updated it by making some lines into red and highlighting some... cool.. :)
Alan Tuscano 1-Feb-12 2:22am View
I found Assembly, but from the error above that i pasted, its referring to another folder named GAC, GAC_MSIL..
Alan Tuscano 31-Jan-12 4:42am View
When I tried to look for folder GAC or any GAC related folder in my WINDOWS, there is none?

Is it part of an installation?
Alan Tuscano 31-Jan-12 0:25am View
I'm using Windows XP sp3, same with the other computer. were also using the same Office 2007.

I downloaded Office 2007 PrimaryInteropAssembly and installed it on the testing computer, and got this new error paste below:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x800A03EC): The specified file wasn't found.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Microsoft.Office.Interop.Excel.Shapes.AddPicture(String Filename, MsoTriState LinkToFile, MsoTriState SaveWithDocument, Single Left, Single Top, Single Width, Single Height)
at MB_Phils.options_DGV.CONSDAILYTRIAL()
at MB_Phils.options_DGV.dgvControls()
at MB_Phils.ReportOpt.Button7_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.PerformClick()
at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)

************** Loaded Assemblies **************
Assembly Version:
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
Assembly Version:
Win32 Version:
CodeBase: file:///C:/MBK/MBK.exe
Assembly Version:
Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/
Assembly Version:
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/
Assembly Version:
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/
Assembly Version:
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/
Assembly Version:
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/
Assembly Version:
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/
Assembly Version:
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/
Assembly Version:
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/
Alan Tuscano 30-Jan-12 22:09pm View
sorry for the reply, tnx Dalek.. :)
Alan Tuscano 29-Jan-12 20:23pm View
Hi OriginalGriff,

Sorry I was out for 2 days, I was busy doing charitable(outreach project) with my group.. Got this one covered Now, and its working.

Thnx again.
Alan Tuscano 27-Jan-12 3:35am View
this is the Error Message Details:

at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
Assembly Version:
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
Assembly Version:
Win32 Version:
CodeBase: file:///C:/GL_EXTRACTOR/GL_EXTRACTOR/bin/Debug/Manual/GL_EXTRACTOR.exe
Assembly Version:
Win32 Version: 8.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/
Assembly Version:
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/
Assembly Version:
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/
Assembly Version:
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/
Assembly Version:
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/
Alan Tuscano 27-Jan-12 3:32am View
Its Windows Application written in VB, and for that matter, i am using VS 2008.
Alan Tuscano 27-Jan-12 3:14am View
Hi SA,
I'm using Visual Studio 2008, i had a Visual Basic Application (is that, i'm not sure coz this is my first time using Visual Basic), copied the application to another pc, and that error appeared.

Is there a way that i can post the screenshot of the error here?
Alan Tuscano 27-Jan-12 3:10am View
Microsoft .Net Framework.

Unhandled Exception has occurred in your application.

Fill: SelectCommand. Connection Property has not been initialized
Alan Tuscano 26-Jan-12 2:59am View
yeah.. :-)
Alan Tuscano 25-Jan-12 1:27am View
Thank you Idle_Force,

How can i hide a column? I need that column for grouping but don't want it displayed in the excel output
Alan Tuscano 24-Jan-12 20:26pm View
just got the solution.. tnx for the help Marcus. :)
Alan Tuscano 20-Jan-12 1:32am View
still, thanks a lot. :)
Alan Tuscano 20-Jan-12 1:28am View
Hi again Abbey and SA,

I come to realize, that I wont be needing the crystal report when i converted the project to VS2008.

Thank You Guys.. :)
Alan Tuscano 20-Jan-12 0:31am View
The former VS2010 project was created in Window 7 OS, now, I'm using a Windows XP sp3 and VS2008.

I'm sorry, I meant this,
C:\Program Files\Microsoft Visual Studio 8.0\Common7\IDE\devenv.exe.config

I have found "devevn.exe.config" but don't know to edit it?
Alan Tuscano 20-Jan-12 0:14am View
Hi Abbey, from the link that you gave, How can I open this ?
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config
Alan Tuscano 20-Jan-12 0:04am View
I'm still debugging the new version, running into some errors that are probably belonging to VS2010 like this..

and this can be easily remove.

but this,
"CrystalReportViewer" is not a member of "Windows.Application1.Form1Main"
Alan Tuscano 19-Jan-12 23:59pm View
Alan Tuscano 19-Jan-12 22:55pm View
Hi Abbey,

Got another converter,

It converted the project from VS2010 to VS2008, but got 1 more problem.
Crystal Report is not included in VS2010, you can download that with the link VS2010 supplies, and install that CR.
While VS2008, includes a Crystal Report in its reporting tools.

And an error came out when I tried to run the project. what to do now?

Alan Tuscano 19-Jan-12 21:59pm View
Hi Abbey and SA,

I tried SA's Solution Converter for 2 samples too..
the first sample,

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DevProj", "DevProj\DevProj.vbproj", "{B467AFD3-50DB-4060-9A0C-5FBBFE7D2701}"
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "DevProjInstaller", "Setup1\Setup1.vdproj", "{25F87934-C102-4B29-A820-816F4C684932}"
Project("{6141683F-8A12-4E36-9623-2EB02B2C2303}") = "SetupDevProj", "SetupDevProj\SetupDevProj.isproj", "{AD554648-5F3E-421F-8FBD-6FDD1C3293BA}"

This .sln give an error at the Solution Converter,
"Unhandled exception has occured in your application..."

The Second sample,
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DevProj", "DevProj\DevProj.vbproj", "{B467AFD3-50DB-4060-9A0C-5FBBFE7D2701}"

converted it successfully.

But when i opened the project, Error List is full of comments of error, also, i can't open the forms....

i also read in the error list about my crystal reports, VS2010 doesn't have the Crystal Report in itself, you need to download a version of CR to be used, i guess that also is a problem.

DevProj is Executable, have created a setup(installer)kit..
Alan Tuscano 19-Jan-12 20:50pm View
Hi, I just did renaming the abovementioned and save the .sln file. double clicked on the project to open it but this error appeared,

'C:\DevProj\SetUpDevProj\SetUpDevProj.isproj' cannot be opened because its project type (.isproj) is not supported by this version of the application.

DevProj is running on other PC.

Also, would downgrading VS2010 to VS2008 affect my crystal reports?
Alan Tuscano 19-Jan-12 0:13am View
Yes Sir, the datatype is nvarchar(10)

Target Table
column name data type allows null
ref nvarchar(10) [] <- yes

Same structure with the source table
Alan Tuscano 19-Jan-12 0:03am View

inside the process which i do is access a table form a remote server, i then copy that table into a textfile in my local server, from there, i then copy the textfile via "BULK INSERT" into my local server TABLE.

I only opened the textfile, after the error appeared, to see whats cuasing my the error, and i found that(the recorsd with Korean Letters).

I checked on the source table, and the same format exist as a record.
Alan Tuscano 18-Jan-12 4:37am View
This explains.

Tnx SaKryukov
Alan Tuscano 18-Jan-12 4:27am View
ah, okay.. now i get it.. :)

Alan Tuscano 18-Jan-12 3:48am View
After doing that,
then will i just copy the folder to another Computer?
Alan Tuscano 16-Jan-12 22:59pm View
I'm using VB 2005

Manually, is the desktop and can be click, and run by a user.
The program has a ComboBox to select the TableName, to gather data, the Date Today, and Process Button to process,

But to give an option, the program will be loaded to the Scheduler,
My idea is i will create procedures(for the pre-selected entries),
and once the Scheduler runs the program, i will just call on the procedures.

But where i will put it the Call ProcedureNames() in the form?
Alan Tuscano 16-Jan-12 22:14pm View
Hi SAKryukov,

I have found the Task Scheduler.

in my GUI, user selects entries will have press PROCESS button,
but in the Scheduled Task, with pre-selected entries, how will I run the process button, and where in the form's event will i put it?
Alan Tuscano 15-Jan-12 20:39pm View
Hi Spopy,

I have established connection..

in my first code,
i then made this
[VMSERVER].PUSAN_KRW_PROD.dbo.GLAC and now can make connection.

I will then do workaround here, doing validations, after validating all the requirements, i will insert/copy the records from this remote server [VMSERVER].PUSAN_KRW_PROD.dbo.GLAC; to my local server [DEVELOPER04\MBWIN].mbmis..DlyGlAcc, but is having this error;
Named Pipes Provider: Could not open a connection to SQL Server [1265]?

Here's my code in copying/inserting of records;

strDLY = my local server ([DEVELOPER04\MBWIN].mbmis..DlyGlAcc)
strGL = remote server ([VMSERVER].PUSAN_KRW_PROD.dbo.GLAC)
Conn = is my local connection

strSQL = "Insert Into " & strDLY & " Select * From " & strGL
Dim dx As New SqlDataAdapter(strSQL, conn)
Dim sx As New DataSet
dx.Fill(sx, "rDlyGlacc")

This error appeared;
Named Pipes Provider: Could not open a connection to SQL Server [1265]?
Alan Tuscano 12-Jan-12 19:59pm View
Using Sql Server 2005

1. I created a table "dlyGLAcc" in my local DEVELOPER04\MBWIN server.
In order for me to fill dlyGLacc with records, i need to access GLAcc from
another server(on Network named "VMSERVER\MBWIN").

Inside VMSERVER\MBWIN, belongs the databases PUSAN_USD_PROD and SEOUL_KRW_PROD,
inside the mentioned databases is a table name "GLAcc", that i need to access
and copy records from that table into dlyGLAcc which is in my Local

2. I then registered VMSERVER\MBWIN and tested its connectivity and gave me a
"The Connection was tested Succesfully", and saved it.

But as i noticed, my local server(DEVELOPER04\MBWIN), has the green triangle
icon that means it is running, and the remote server(VMSERVER\MBWIN) has
a white circle.

How will access table GLAcc from the remote server(VMSERVER\MBWIN), inside

I tried this code
select * from vmserver...glac

and resulted an error
OLE DB provider "SQLNCLI" for linked server "vmserver" returned message "Login timeout expired".
OLE DB provider "SQLNCLI" for linked server "vmserver" returned message "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.".
Msg 53, Level 16, State 1, Line 0
Named Pipes Provider: Could not open a connection to SQL Server [53].

Alan Tuscano 12-Jan-12 2:27am View
I just did this, but still an error appeared,

OLE DB provider "SQLNCLI" for linked server "VMSERVER" returned message "Login timeout expired".
OLE DB provider "SQLNCLI" for linked server "VMSERVER" returned message "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.".
Msg 53, Level 16, State 1, Line 0
Named Pipes Provider: Could not open a connection to SQL Server [53].
Alan Tuscano 12-Jan-12 0:52am View
its like this, table grGroup1 from server1 is newly created copying the same table structure from table grGroup1 located in server2. Table grGroup1 from server1 is empty and records to insert will be coming from grGroup1 located in server2.

I've done this;
SELECT * FROM server2.[dbCon].dbo.[grGroup1]

And this error appeared;
Msg 7202, Level 11, State 2, Line 1
Could not find server 'server2' in sysservers. Execute sp_addlinkedserver to add the server to sysservers.

dbWin server is my local db server while dbCon Server is a database server i access on the network. I want to append records from gr1Group from dbCon Server into gr1Group located in dbWin server. is it possible?

Please show me how?
Alan Tuscano 15-Nov-11 20:00pm View
Hi ShabanaParveen,

Thanks for the reply, and pardon me for using the word "back Up"...

I mean, I literally cannot create a New Database in the SQL SERVER 2005,

BTW, I access SQL SERVER 2005 using remote connection.

And I'm using SQL Server 2008R2, 2 pc here in the ofc is using SQL Server 2008R2 and both cannot create New Database
Alan Tuscano 7-Nov-11 22:55pm View
Thanks Mark, I'll work on this now..
Alan Tuscano 3-Nov-11 21:44pm View
Hi Raimis9,

I found a super shortcut easy way... :)

Dim Var_ds as String = DsVarName & ".xsd"
Dim da As SqlDataAdapter = New SqlDataAdapter(comm)
Dim myDS As New DataSet(Var_ds)

Hope this can help others also as it is working fine with me. :)
Alan Tuscano 3-Nov-11 5:13am View
i created a Dataset in the project's root,
did your code,

but inside this function
Public Function CreateObjectInstance(ByVal objectName As String) As Object
' Creates and returns an instance of any object in the assembly by its type name.

Dim obj As Object

If objectName.LastIndexOf(".") = -1 Then
'Appends the root namespace if not specified.
objectName = [Assembly].GetEntryAssembly.GetName.Name & "." & objectName
End If

obj = [Assembly].GetEntryAssembly.CreateInstance(objectName)
---- > after this where object returns "Nothing"

Catch ex As Exception
obj = Nothing
End Try
Return obj

End Function
Alan Tuscano 3-Nov-11 4:46am View
inside a folder named Dataset
Alan Tuscano 3-Nov-11 4:25am View
Hi Sir,

I tried, but in Function CreateObjectInstance

obj returns "nothing"
Alan Tuscano 3-Nov-11 3:02am View
Hi Raimis9,

Thank you Again for helping me with my first query! :)

with my second Question, Actually sir, I already did that... What i wanted to do is to eliminate the use of "Select Case" as in reality, I have 45 Crystal Reports to do.. in which that 41 reports already has a DS, my Boss ask me to make some changes especially with the Long Procedure i did...
huhuhuh... after typing lots of it... he wants me lessen the coding.

and its really my choice as its the one i know.
Alan Tuscano 3-Nov-11 2:04am View
Hi again Raimis9 & RaisKazi,

I have found the error, what i did is add the directory(folder map) of my .rpt...

Thank you so much..

Now, my other problem is also in the initial post.
working with Dataset,

Dim da As SqlDataAdapter = New SqlDataAdapter(comm)
Dim myDS As New GR01_ds() <------ this is for GR01_rpt report,

what i want to do is,
Dim myDS As New Var_Ds()
wherein Var_Ds will represent any DataSet that is for a specific report,
GR01_ds is for GR01_rpt Report,
Gr02_ds is for GR02_rpt Report,
Gr03_ds is for GR03_ rpt Report,
up to GR23_ds

If User selects GR-07 Report,
Var_Ds will be GR07_ds,

my code will then be like,
Dim da As SqlDataAdapter = New SqlDataAdapter(comm)
Dim myDS As New Var_ds()

da.Fill(myDS, myRPT)
ReportMain.CrystalReportViewer2.ReportSource = rpt


Hope that my Explaination can be understood..
Alan Tuscano 2-Nov-11 20:42pm View
Alan Tuscano - 10 secs ago
Hi and Good Morning Raimis9 & RaisKazi,

I wanted to paste the screen shot of the error but donno how.. :)

i did your code but got Error:
CrystalReportsException was unhandled by user code.
-- Load Failed.

My rpt Files is inside a folder of my solution, does it make effect?
Alan Tuscano 2-Nov-11 20:36pm View
Hi and Good Morning Raimis9 & RaisKazi,

I wanted to paste the screen shot of the error but donno how.. :)

i did your code but got Error:
CrystalReportsException was unhandled by user code.
-- Load Failed.

My rpt Files is inside a folder of my solution, does it make effect?
Alan Tuscano 27-Oct-11 21:46pm View
Thanks for the suggestion SAKryukov, I'll be more specific..
Thanks Man! :)
Alan Tuscano 27-Oct-11 21:41pm View
What do you Mean?

to avoid complex coding in vb, i instead created a 53 stored proc pointed to the reports,
i don't want to use Case Select as i will be creating 53 Cases...
Alan Tuscano 23-Oct-11 21:29pm View
I'm sorry sir,

I'm just a newbie in vb programming.. i am into VFP.. this is my first project using VB.. that is why i'm asking for help... i don't know how to call or refer to my problem..

After the User Selected Values from the 3 combo boxes, codes from the combo boxes is truncated and will look like "REG_IVCaviteBacoor" and is assigned to spName,

"spName then becomes CALL REG_IVCaviteBacoor()" and when executed will be like the one below..

CALL REG_IVCaviteBacoor()

Private Sub REG_IVCaviteBacoor()
End Sub
Alan Tuscano 21-Oct-11 2:51am View

Alan Tuscano 18-Oct-11 21:13pm View
<pre lang="vb">
Call DBMain() 'Connection

ComboBox1.Text = "KRW"

frmdata03.Show() 'main form
frmtxn01.Hide() 'main form
frmdata04.Hide() 'main form
ReportMain.Hide() 'main form

Call GR01(TextBox4.Text, TextBox5.Text, ComboBox1.Text, frmdata03.DataGridView1) ' Method
Close() ' to release this (2nd) form

'DGV to be flooded with records which is in main form
frmdata03.DataGridView1.Width = 752
frmdata03.DataGridView1.Height = 619
frmdata03.DataGridView1.Visible = True
frmdata03.Button1.Visible = True</pre>

'this is the code inside the method
RSP_GR01 is a stored procedure

<pre lang="vb">Public Function GR01(ByVal findate1 As String, ByVal finddate2 As String, ByVal findbr As String, ByRef dgv As DataGridView)
'ByVal findcurr As String, ByRef dgv As DataGridView)

Dim con As New SqlConnection
Dim str As String = Configuration.ConfigurationManager.ConnectionStrings("mbmisConnectionString").ConnectionString
con.ConnectionString = str

Dim comm As SqlCommand = New SqlCommand("RSP_GR01", con)
comm.CommandType = CommandType.StoredProcedure

Dim objParam As SqlParameter
objParam = comm.Parameters.Add("@fromdate", SqlDbType.NVarChar, 10)
objParam.Direction = ParameterDirection.Input
objParam.Value = findate1

objParam = comm.Parameters.Add("@toDate", SqlDbType.NVarChar, 10)
objParam.Direction = ParameterDirection.Input
objParam.Value = finddate2

objParam = comm.Parameters.Add("@branch_CD", SqlDbType.NVarChar, 4)
objParam.Direction = ParameterDirection.Input
objParam.Value = findBr


Dim da As SqlDataAdapter = New SqlDataAdapter(comm)
Dim myds As New DataSet

dgv.DataSource = myds.Tables(0).DefaultView

End Function</pre>
Alan Tuscano 18-Oct-11 3:52am View
Thank You pathumFer... I have successfully installed CR in my desktop... Ü
Alan Tuscano 7-Oct-11 0:59am View
Hi GanesanSenthivel,

Thank you for the Link But I'm a newbie in vs 2010, also, i'm a stranger to CR as i use vs reportviewer.

To give a scenario of what i did before posting here,
I Right clicked on my project, selected Add new item then click reporting, selected Crystal Reports, a link to download SAPs' CR... i downloaded and installed... after installing...

There, thats where i stopped... coz' i have no idea on what to do next???
Alan Tuscano 30-Aug-11 22:21pm View
i do it in the design mode sir.. i created the dataset using wizard sir..
Alan Tuscano 18-Aug-11 2:26am View
Thanks Damian...
Alan Tuscano 17-Aug-11 22:54pm View
If its okay, could you give me way to do it..
Alan Tuscano 4-Aug-11 3:58am View
Hi Sanjeev

Yup, it does, i've checked it also just to be sure and it allows null.

How will I pass a Null value..

maskedtextbox value is " / /"

SSQL = "INSERT INTO resibo ( recpno, recpdt, .............) values " & _
"(" & textbox1.text & ",'" & maskedtextbox & "'.........

Thanks for the quick reply sanjeev. Ü
Alan Tuscano 27-Jul-11 22:57pm View
Different Report layout and Data... The User will select Report Type from my ComboBox and process.

That means that when User selects say "Per Header" and process, tblperheader.rdlc then will be the report source of the reportviewer, if the user wants General Summary Report, tblgenSum.rdlc will then be the report source of the report viewer.
Alan Tuscano 27-Jul-11 22:53pm View
We've want to use CR but, other user PC requires CR version installation, as to ReportViewer which is included in the VB/VS2008 Express Installer.