Reading files from application path may be one of key requirement of any application. Actually we can place many place you love to have, on a installation machine there can be restriction as well.
Like wise in a Windows system, installer may want to put apps and other files to Programfiles. This folder intended to work with executable,configuration files etc. You can’t programmatically create new folder or files in Programfiles folder, which may require some admin rights. So where we kept those documents and other data ?
It is wise to store such files on Application data folder or even on your Document folder. For reports and other stuffs Document folder is enough.
Access Special Folders
We can use the Enironment.SpecialFolder to access the App data and Documents and also can fetch path to those folders using GetFolderPath method of Environment class.
As we have seen how to delete rows in a dataset in C#.Net, there are simple ways to do the same using SQL command object. All we need is an sql statement and an Object to do the job.
con.open();Common.cmd = new SqlCommand("delete from purchasepart where billno=" + b1, Common.con);
cmd object configure the delete statement and call the ExecuteNonQuery() , and will delete those rows you are specified. Keep in mind that the connection should kept open while the ExecuteNonQuery(); method invoked.
with the SqlParameter we can pass values to the SQL Procedure that we are going to create in next step. The commandType of stored procedure indicate the it is StoredProcedure. Now all we need is a Procedure.
Design your SQL Stored Procedure
Open you SQL Server Explorer or SQL Server Itself and expand Procedure node and drop the following line of code.
ALTER PROCEDURE dbo.CRUDS_PRODUCTMASTER
insert into productmaster (item,mfr) values(@item,@mfr,);
The parameters in C# and SQL should match otherwise it will cause errors.
Listing all printers with name, Port in VB6 is simple as listing default printer port using Kernel32 library . Today we going show you how to do this.
As usual we start with function declaration, then define a new function which add all information into a list box. Here we goes
Kernel32 GetProfileString method
Declare Function GetProfileString Lib “kernel32.dll” Alias “GetProfileStringA” (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As Long
Add printer information into a list box
Public Sub GetPrinterList(lstPrinter As ListBox)Dim PrintData As PrinterDim defprinterpos%
Let me show how to add a new field into an existing access database using Visual Basic 6.0.Using the tableDef and Filed object you can create new fields. Firstly, you need to create Database and Recordset object, mke sure the DAO access object library. Continue reading →