If IsDBNull(DataGridView1.CurrentRow.Cells(0).Value) Then
txtKd_Aktiva.Text = ""
txtKd_Dept.Text = ""
Else
txtKd_Aktiva.Text = DataGridView1.CurrentRow.Cells(0).Value
txtKd_Dept.Text = DataGridView1.CurrentRow.Cells(1).Value
End If
Sunday, November 17, 2013
Wednesday, November 13, 2013
ToolStrip Collect Command
-- save
Private Sub SaveToolStripButton_Click(sender As Object, e As EventArgs) Handles SaveToolStripButton.Click
Dim frm As Object = Me.ActiveMdiChild
If frm Is Nothing Then Return
Call frm.save()
End Sub
--delete
Private Sub DeleteToolStripButton_Click(sender As Object, e As EventArgs) Handles DeleteToolStripButton.Click
If MsgBox("Are you sure want to Delete?", MsgBoxStyle.YesNo, "Delete") = MsgBoxResult.Yes Then
Dim frm As Object = Me.ActiveMdiChild
If frm Is Nothing Then Return
Call frm.delete()
Else
MsgBox("You aren't deleted")
End If
End Sub
--filter
Private Sub FilterToolStripButton_Click(sender As Object, e As EventArgs) Handles FilterToolStripButton.Click
Dim frm As Object = Me.ActiveMdiChild
If frm Is Nothing Then Return
Call frm.Filter()
End Sub
Private Sub SaveToolStripButton_Click(sender As Object, e As EventArgs) Handles SaveToolStripButton.Click
Dim frm As Object = Me.ActiveMdiChild
If frm Is Nothing Then Return
Call frm.save()
End Sub
--delete
Private Sub DeleteToolStripButton_Click(sender As Object, e As EventArgs) Handles DeleteToolStripButton.Click
If MsgBox("Are you sure want to Delete?", MsgBoxStyle.YesNo, "Delete") = MsgBoxResult.Yes Then
Dim frm As Object = Me.ActiveMdiChild
If frm Is Nothing Then Return
Call frm.delete()
Else
MsgBox("You aren't deleted")
End If
End Sub
--filter
Private Sub FilterToolStripButton_Click(sender As Object, e As EventArgs) Handles FilterToolStripButton.Click
Dim frm As Object = Me.ActiveMdiChild
If frm Is Nothing Then Return
Call frm.Filter()
End Sub
Saturday, November 2, 2013
Convert Dbf to MySQL
Step by step for convert Dbf to MySql
1. Convert Dbf to Xls with Foxpro command. Example for copy file ledger.dbf to ledger.xls, you can used this script "Copy to ledger type xls".
2. Convert Xls to Mdb Online with zamzar.com.
3. Convert Mdb to Sql with MySQL Migration Toolkit.
4. Create table ledger in database MySql.
5. Import table from step 3.
1. Convert Dbf to Xls with Foxpro command. Example for copy file ledger.dbf to ledger.xls, you can used this script "Copy to ledger type xls".
2. Convert Xls to Mdb Online with zamzar.com.
3. Convert Mdb to Sql with MySQL Migration Toolkit.
4. Create table ledger in database MySql.
5. Import table from step 3.
Sunday, October 27, 2013
Microsoft Report Viewer with MySQL - VB.net
You can see this tutorial at youtube :
Part 1 :
http://www.youtube.com/watch?v=tuwZNSwTjEI
Part 2 :
http://www.youtube.com/watch?v=-Ic64qxWf0k
Part 1 :
http://www.youtube.com/watch?v=tuwZNSwTjEI
Part 2 :
http://www.youtube.com/watch?v=-Ic64qxWf0k
Sunday, October 20, 2013
RDLC Reporting Example
If you want create RDLC Reporting example, you can see in youtube :
http://www.youtube.com/watch?v=NVImPdRbVAs
http://www.youtube.com/watch?v=NVImPdRbVAs
Tuesday, October 15, 2013
Rdlc
Rdlc, yes. This name for pure report from Visual Studio.
Report Designer (Visual Studio)
Report Designer (Visual Studio)
The Visual Studio Report Designer provides a user-friendly interface for creating robust reports that include data from multiple types of data sources.
In Visual Studio, reports are saved as client report definition (.rdlc) files. These files are based on the same schema as report definition (.rdl) files published on SQL Server Reporting Services report servers, but they are stored and processed differently than .rdl files. At run time, the .rdlc files are processed locally, and the .rdl files are processed remotely.
Source : http://msdn.microsoft.com/en-us/library/bb558708.aspx
Source : http://msdn.microsoft.com/en-us/library/bb558708.aspx
SAP Crystal Reports, developer version for Microsoft Visual Studio - 2012 Now Available for Download
New In This Release
New branding for the product;
Now called “SAP Crystal Reports, developer version for Microsoft Visual Studio”
Now called “SAP Crystal Reports, developer version for Microsoft Visual Studio”
Support integration with Visual Studio 2012 and 4.5 .NET Framework runtime.
Added support for following platforms:
a. OS: Windows 7 SP1, Windows 8, Windows 2012
b. Database: SQL Server 2012, HANA SP5
c. Web Browser: Firefox 16, IE10 (limited support; more information forthcoming soon)
d. Other technology: IIS 8, Flash 11
Download Locations
PLEASE NOTE:
Any queries, issues, problems, etc., should be posted as a Discussion in the SAP Crystal Reports, version for Visual Studio Space. Queries posted as Comments will not be answered.
Source : http://scn.sap.com/docs/DOC-35074
Source : http://scn.sap.com/docs/DOC-35074
Monday, October 14, 2013
Insert, Update
Insert :
Insert myTable(myField1, myField2,myField3) values ('Value1','Value2','Value3')
Update :
Update myTable set myField = newValue where myKey = myKeyField
Insert myTable(myField1, myField2,myField3) values ('Value1','Value2','Value3')
Update :
Update myTable set myField = newValue where myKey = myKeyField
SaveToolStripButton
Save with SaveToolStripButton
Private Sub SaveToolStripButton_Click(sender As Object, e As EventArgs) Handles SaveToolStripButton.Click
Dim frm As Object = Me.ActiveMdiChild
If frm Is Nothing Then Return
Call frm.save()
End Sub
In form mdiChild
Public Class frmChangePassword
Public Sub Save()
Dim Query As String
Dim sDB = New sqlDB
Query = "insert jnsbrg(kelomp_brg,nm_jns_brg) VALUES ('"
Query = Query + txtKelomp_Brg.Text + "','" + txtNm_Jns_Brg.Text + "')"
sDB.executeSQL(Query)
MDIParent1.SaveToolStripButton.Enabled = False
MDIParent1.NewToolStripButton.Enabled = True
End Sub
End Class
Private Sub SaveToolStripButton_Click(sender As Object, e As EventArgs) Handles SaveToolStripButton.Click
Dim frm As Object = Me.ActiveMdiChild
If frm Is Nothing Then Return
Call frm.save()
End Sub
In form mdiChild
Public Class frmChangePassword
Public Sub Save()
Dim Query As String
Dim sDB = New sqlDB
Query = "insert jnsbrg(kelomp_brg,nm_jns_brg) VALUES ('"
Query = Query + txtKelomp_Brg.Text + "','" + txtNm_Jns_Brg.Text + "')"
sDB.executeSQL(Query)
MDIParent1.SaveToolStripButton.Enabled = False
MDIParent1.NewToolStripButton.Enabled = True
End Sub
End Class
Standardized Naming Conventions for Visual Basic .NET
When you’re programming, names are important. If you’re programming with Visual Basic .NET, the following table can be a major help in getting the names right. It gives the common prefix to use when naming objects so you can quickly tell your check boxes from your combo boxes and your radio buttons from your record sets.
Prefix | Corresponding Object | Example | Prefix | Corresponding Object | Example |
---|---|---|---|---|---|
Acd | ActiveDoc | AcdMainPage | Hpl | HyperLink | HplURL |
Chk | CheckBox | ChkBoldface | Lbl | Label | LblContents |
Cbo | ComboBox | CboDropper | Lst | ListBox | LstNames |
Cm | ADO command (database) | CmMyCommand | Pag | Page | PagTurn |
Cmd | CommandButton | CmdExit | Pgf | PageFrame | PgfRule |
Cmg | CommandGroup | CmgSelectOne | Prj | ProjectHook | PrjSuzerine |
Cn | Connection (database) | CnMyConnex | Rb | RadioButton | RbBlueBackground |
Con | Container | CntFramed | Rs | Recordset (database) | RsTotalSales |
Ctr | Control | CtlSeeThis | Sep | Separator | SepZone |
Fld | Field (database) | FldTitles | Spn | Spinner | SpnWatch |
Frm | Form | FrmColors | Txt | TextBox | TxtAddress |
Frs | FormSet | FrsTypeIn | Tmr | Timer | TmrAnimation |
Grd | Grid | GrdGoods | Tbr | ToolBar | TbrDropThis |
Grc | Column (in grid) | GrcQuantity | Tbl | Table (database) | TblTitles |
Grh | Header (in grid) | GrhYearsResults |
Source : http://www.dummies.com/how-to/content/standardized-naming-conventions-for-visual-basic-n.html
Other link for naming conventions :
http://www.ssw.com.au/ssw/Standards/DeveloperdotNET/DotNetStandard_ObjectNaming.aspx
Other link for naming conventions :
http://www.ssw.com.au/ssw/Standards/DeveloperdotNET/DotNetStandard_ObjectNaming.aspx
Mod Operator
Divides two numbers and returns only the remainder.
If you familiar with foxpro, this operator same with %.
Dim testResult As Double testResult = 10 Mod 5 testResult = 10 Mod 3 testResult = 12 Mod 4.3 testResult = 12.6 Mod 5 testResult = 47.9 Mod 9.35The expressions in the previous example return values of 0, 1, 3.4, 2.6, and 1.15.
If you familiar with foxpro, this operator same with %.
Math.Round Method
Rounds a value to the nearest integer or to the specified number of fractional digits.
This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.
Overload List
Source : http://msdn.microsoft.com/en-us/library/system.math.round.aspx
Overload List
Name
|
Description
|
Rounds a decimal value to the nearest
integral value.
|
|
Rounds a double-precision floating-point
value to the nearest integral value.
|
|
Rounds a decimal value to a specified number
of fractional digits.
|
|
Rounds a decimal value to the nearest
integer. A parameter specifies how to round the value if it is midway between
two numbers.
|
|
Rounds a double-precision floating-point
value to a specified number of fractional digits.
|
|
Rounds a double-precision floating-point
value to the nearest integer. A parameter specifies how to round the value if
it is midway between two numbers.
|
|
Rounds a decimal value to a specified number
of fractional digits. A parameter specifies how to round the value if it is
midway between two numbers.
|
|
Rounds a double-precision floating-point
value to a specified number of fractional digits. A parameter specifies how
to round the value if it is midway between two numbers.
|
Source : http://msdn.microsoft.com/en-us/library/system.math.round.aspx
Sunday, October 13, 2013
Innodb_force_recovery
If you get this message, you can added innodb_force_recovery = 6 to my.conf.
#The mySQL sever
[mysqld]
...
...
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_force_recovery = 6
If you use xamp, this file at directory xamp\mysql\bin.
2013-10-14 05:37:43 2508 [Note] Plugin 'FEDERATED' is disabled.
2013-10-14 05:37:43 9d0 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2013-10-14 05:37:43 2508 [Note] InnoDB: The InnoDB memory heap is disabled
2013-10-14 05:37:43 2508 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2013-10-14 05:37:43 2508 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-10-14 05:37:43 2508 [Note] InnoDB: Not using CPU crc32 instructions
2013-10-14 05:37:43 2508 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2013-10-14 05:37:43 2508 [Note] InnoDB: Completed initialization of buffer pool
2013-10-14 05:37:43 2508 [Note] InnoDB: Highest supported file format is Barracuda.
2013-10-14 05:37:43 2508 [Note] InnoDB: The log sequence numbers 0 and 0 in ibdata files do not match the log sequence number 1605539 in the ib_logfiles!
2013-10-14 05:37:43 2508 [Note] InnoDB: Database was not shutdown normally!
2013-10-14 05:37:43 2508 [Note] InnoDB: Starting crash recovery.
2013-10-14 05:37:43 2508 [Note] InnoDB: Reading tablespace information from the .ibd files...
2013-10-14 05:37:43 2508 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace mysql/slave_relay_log_info uses space ID: 3 at filepath: .\mysql\slave_relay_log_info.ibd. Cannot open tablespace namedatabase\nametable which uses space ID: 3 at filepath: .\namedatabase\nametable.ibd
InnoDB: Error: could not open single-table tablespace file .\namedatabase\nametable.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
#The mySQL sever
[mysqld]
...
...
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_force_recovery = 6
If you use xamp, this file at directory xamp\mysql\bin.
2013-10-14 05:37:43 2508 [Note] Plugin 'FEDERATED' is disabled.
2013-10-14 05:37:43 9d0 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2013-10-14 05:37:43 2508 [Note] InnoDB: The InnoDB memory heap is disabled
2013-10-14 05:37:43 2508 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2013-10-14 05:37:43 2508 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-10-14 05:37:43 2508 [Note] InnoDB: Not using CPU crc32 instructions
2013-10-14 05:37:43 2508 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2013-10-14 05:37:43 2508 [Note] InnoDB: Completed initialization of buffer pool
2013-10-14 05:37:43 2508 [Note] InnoDB: Highest supported file format is Barracuda.
2013-10-14 05:37:43 2508 [Note] InnoDB: The log sequence numbers 0 and 0 in ibdata files do not match the log sequence number 1605539 in the ib_logfiles!
2013-10-14 05:37:43 2508 [Note] InnoDB: Database was not shutdown normally!
2013-10-14 05:37:43 2508 [Note] InnoDB: Starting crash recovery.
2013-10-14 05:37:43 2508 [Note] InnoDB: Reading tablespace information from the .ibd files...
2013-10-14 05:37:43 2508 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace mysql/slave_relay_log_info uses space ID: 3 at filepath: .\mysql\slave_relay_log_info.ibd. Cannot open tablespace namedatabase\nametable which uses space ID: 3 at filepath: .\namedatabase\nametable.ibd
InnoDB: Error: could not open single-table tablespace file .\namedatabase\nametable.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
innodb_force_recovery
is 0 by default (normal startup without forced recovery) The permissible nonzero values forinnodb_force_recovery
follow. A larger number includes all precautions of smaller numbers. If you are able to dump your tables with an option value of at most 4, then you are relatively safe that only some data on corrupt individual pages is lost. A value of 6 is more drastic because database pages are left in an obsolete state, which in turn may introduce more corruption into B-trees and other database structures.
1
(SRV_FORCE_IGNORE_CORRUPT
)Let the server run even if it detects a corrupt page. Try to makeSELECT * FROM
jump over corrupt index records and pages, which helps in dumping tables.tbl_name
2
(SRV_FORCE_NO_BACKGROUND
)Prevent the main thread from running. If a crash would occur during the purge operation, this recovery value prevents it.3
(SRV_FORCE_NO_TRX_UNDO
)Do not run transaction rollbacks after recovery.4
(SRV_FORCE_NO_IBUF_MERGE
)Prevent insert buffer merge operations. If they would cause a crash, do not do them. Do not calculate table statistics.5
(SRV_FORCE_NO_UNDO_LOG_SCAN
)Do not look at undo logs when starting the database:InnoDB
treats even incomplete transactions as committed.6
(SRV_FORCE_NO_LOG_REDO
)Do not do the log roll-forward in connection with recovery.Information further can look at http://dev.mysql.com/doc/refman/5.0/en/forcing-innodb-recovery.html
Tablespace exist
If you look message ...
You delete ...\mysql\data\namedatabase\nametable.
You delete ...\mysql\data\namedatabase\nametable.
Login
If you will create Login, you can use this script :
Imports MySql.Data.MySqlClient
Private Sub cmbOK_Click(sender As Object, e As EventArgs) Handles cmbOK.Click
Dim conn As MySqlConnection
'Connect to the database using these credentials
conn = New MySqlConnection
conn.ConnectionString = "Data Source=127.0.0.1;Database= namedatabase;User ID=name user;Password= password;"
'Try and connect (conn.open)
Try
conn.Open()
Catch myerror As MySqlException 'If it fails do this... (i.e. no internet or intranet connection, etc.)
MsgBox("Error connecting to database. Check your internet / intranet connection.", MsgBoxStyle.Critical)
End Try
'MySQL query (where to call for information)
Dim myAdapter As New MySqlDataAdapter
'Tell where to find the file with the emails/passes stored
Dim sqlquery = "SELECT * FROM userid WHERE UserID = '" & txtUserID.Text & "' AND Password = '" & txtPassword.Text & "'"
Dim myCommand As New MySqlCommand
myCommand.Connection = conn
myCommand.CommandText = sqlquery
'Start query
myAdapter.SelectCommand = myCommand
Dim myData As MySqlDataReader
myData = myCommand.ExecuteReader
'See if the user exists
If myData.HasRows = 0 Then
MsgBox("Invalid user id or password.", MsgBoxStyle.Critical)
'Insert your settings change here. (i.e. My.Settings.LoggedIn = False)
Else
MsgBox("Logged in as " & txtUserID.Text & ".", MsgBoxStyle.Information)
'MDIParent1.gcUserID = txtUserID.Text
MDIParent1.ToolStripStatusLabel.Text = "Logged in as : " & txtUserID.Text
'Another settings change: My.Settings.LoggedIn = True
Me.Close() 'close the login form End Sub
End If
End Sub
Imports MySql.Data.MySqlClient
Private Sub cmbOK_Click(sender As Object, e As EventArgs) Handles cmbOK.Click
Dim conn As MySqlConnection
'Connect to the database using these credentials
conn = New MySqlConnection
conn.ConnectionString = "Data Source=127.0.0.1;Database= namedatabase;User ID=name user;Password= password;"
'Try and connect (conn.open)
Try
conn.Open()
Catch myerror As MySqlException 'If it fails do this... (i.e. no internet or intranet connection, etc.)
MsgBox("Error connecting to database. Check your internet / intranet connection.", MsgBoxStyle.Critical)
End Try
'MySQL query (where to call for information)
Dim myAdapter As New MySqlDataAdapter
'Tell where to find the file with the emails/passes stored
Dim sqlquery = "SELECT * FROM userid WHERE UserID = '" & txtUserID.Text & "' AND Password = '" & txtPassword.Text & "'"
Dim myCommand As New MySqlCommand
myCommand.Connection = conn
myCommand.CommandText = sqlquery
'Start query
myAdapter.SelectCommand = myCommand
Dim myData As MySqlDataReader
myData = myCommand.ExecuteReader
'See if the user exists
If myData.HasRows = 0 Then
MsgBox("Invalid user id or password.", MsgBoxStyle.Critical)
'Insert your settings change here. (i.e. My.Settings.LoggedIn = False)
Else
MsgBox("Logged in as " & txtUserID.Text & ".", MsgBoxStyle.Information)
'MDIParent1.gcUserID = txtUserID.Text
MDIParent1.ToolStripStatusLabel.Text = "Logged in as : " & txtUserID.Text
'Another settings change: My.Settings.LoggedIn = True
Me.Close() 'close the login form End Sub
End If
End Sub
Saturday, October 5, 2013
Hello World
Visual Studio Languages
Find the resources for learning and for using the Visual Studio languages, to build the applications you need.ramming models.
Visual C++
Get the resources to learn and use the powerful and flexible Visual C++ language, with the tools to enable the development of native Windows apps, native desktop apps, and managed apps that run on the .NET Framework.
Visual C#
Get an introduction to C#, an elegant and type-safe object-oriented language that enables developers to build a variety of secure and robust applications that run on the .NET Framework. Find the resources for learning Visual C#, and for building application.
Visual Basic
Discover a wealth of resources for learning and using Visual Basic, a language engineered for productively building type-safe and object-oriented applications, for both the beginner and the experienced developer.
JavaScript
Learn about how to use Microsoft's implementation of JavaScript, which is compliant with the ECMAScript Language Specification 5th Edition, for creating Windows Store and Windows Phone apps, and on the web.
Visual F#
Build your Visual F# development skills and learn about the F# language, a multi-paradigm programming language targeting the .NET platform. The F# language supports functional, object-oriented, and imperative programming models.
Visual C++
Get the resources to learn and use the powerful and flexible Visual C++ language, with the tools to enable the development of native Windows apps, native desktop apps, and managed apps that run on the .NET Framework.
Visual C#
Get an introduction to C#, an elegant and type-safe object-oriented language that enables developers to build a variety of secure and robust applications that run on the .NET Framework. Find the resources for learning Visual C#, and for building application.
Visual Basic
Discover a wealth of resources for learning and using Visual Basic, a language engineered for productively building type-safe and object-oriented applications, for both the beginner and the experienced developer.
JavaScript
Learn about how to use Microsoft's implementation of JavaScript, which is compliant with the ECMAScript Language Specification 5th Edition, for creating Windows Store and Windows Phone apps, and on the web.
Visual F#
Build your Visual F# development skills and learn about the F# language, a multi-paradigm programming language targeting the .NET platform. The F# language supports functional, object-oriented, and imperative programming models.
Simple call form from MDIParent
If you want call form from MDIParent, this script is manner for this case :
Form menu in MDIParent, click this menu, then it's show procedure click as like below.
Private Sub StockToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles StockToolStripMenuItem.Click
frmStock.MdiParent = Me
frmStock.Show()
End Sub
Form menu in MDIParent, click this menu, then it's show procedure click as like below.
Private Sub StockToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles StockToolStripMenuItem.Click
frmStock.MdiParent = Me
frmStock.Show()
End Sub
Subscribe to:
Posts (Atom)