Skip to main content

Posts

How To Set Auto Number Which Reset Daily Number

Below script is how to use an auto number using SQL database which support to reset auto number everyday. means record data will be reset to 001 when the day is changing. Public Overridable Function SerialOrderId_AutoNum() As String         MeDB.TutupKoneksi()         DTS = New DataSet         DTA = New  _               SqlDataAdapter("SELECT SerialOrderId FROM SerialOrder_Table " & _                              "WHERE YEAR(LEFT(SerialOrderId,8)) + MONTH(LEFT(SerialOrderId,8)) " & _                              "+ DAY(LEFT(Seria...

How To Get Column List Of Database

This is how to get a Field Name list to each database. after you understand about below script you can use the common select query to get fieldname that you wanted from any database and any table. Try these script at your SQL Query USE ABC SELECT * FROM INFORMATION_SCHEMA.Tables Note : ABC is your database name, and do not change other script. then see what do you get from it. then try other script. USE ABC SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME ='View_ABC' Note : View_ABC is a view name. You will understand 2nd script after you run the first script for a simple select query is just like this way at VB form query. SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME ='View_ABC'

How To Get Week Number Of The Year

Once upon a time i need to create project using week number of the year. means i need to have a number which shows me week number. so below is how to get that result. note : i wrote something like (xxxxx - 1) that is because my project has a different week start date, so if i did not (-1) i'll have incorrect number. please remember the correct number based on world datetime is without (-1), that is my case my personal case.... code : Val(CAL.GetWeekOfYear(TanggalBerapa, CWR, DOW)) - 1 Imports System.Globalization  Public Sub CHECKING_WEEK()         Dim CI As New CultureInfo("en-IN")         Dim CAL As Calendar = CI.Calendar         Dim CWR As CalendarWeekRule = CI.DateTimeFormat.CalendarWeekRule         Dim DOW As DayOfWeek = CI.DateTimeFormat.FirstDayOfWeek         Dim Tgl As Stri...

How To Handling Quote (') In VB.Net

hi there here i will share the way to handle quote (') during coding with VB.Net sometimes we will have data such as (MAT'L) that quote is definitely forbidden when we are use the data. create a function as below : Public Function Ganti(ByVal Kata As String) As String         Ganti = Replace(Kata, "'", "''")     End Function and here is this how you gonna use that function, read carefully Public Sub InsertDataDefect(ByVal Row As Integer)         Dim DefectName As String = dgvInputBMISDetail.Rows(Row).Cells("dgvInputBMISDetailDefectName").Value.ToString         Koneksi()         cmd = New SqlCommand("SELECT * FROM dbo.mstDEFECT WHERE (ActiveTo IS NULL) AND DefectName='" & Ganti(DefectName) & "'", Conn)         rd = cmd.ExecuteReader         rd.Read(...

How To Check Picture In Database

 Private Sub CARI_FOTO()         MyConnection.TUTUPKONEKSI()         cmd = New SqlCommand("Select Photo, AutoRecordNoStamp From mstSTAMP " & _                             "Where AutoRecordNoStamp='" & LblAutoStampNo.Text & "'", MyConnection.BUKAKONEKSI)         DTR = cmd.ExecuteReader         DTR.Read()         'Cek kalo2 data gambar ada ato gak didalam database 01.12.2014         If DTR("Photo").ToString <> "" Then             Dim Gambar As New IO.MemoryStream _             (CType(DgvSTAMP.Item(7, DgvSTAMP.CurrentR...

How To Check If Cell Value In Datagridview Is Null Or Empty

Here is this another thing that i try to solve in doing a project with VB.Net. Scheme : i want my application to load data from datagridview to textbox or combobox but the trouble is datagridview cannot load data from an empty/null cell column.   Private Sub DgvSTAMP_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DgvSTAMP.CellContentClick        'Cek bila nilai pada cell di datagridview ada yang kosong         For F As Integer = 0 To DgvSTAMP.RowCount - 1             If IsDBNull(DgvSTAMP.CurrentRow.Cells(1).Value) Then                 TxtSTAMPNO.Text = ""             Else               ...

How To Load Month And Year In ComboBox Using VB.Net

create 2 ComboBox 1. CmbBulan 2. CmbTahun Private Sub Isi_Combo_Pencarian()         With CmbBulan             Dim Angka As Integer             .DataSource = Nothing             .Items.Clear()             For i = 0 To 11                 Angka = i + 1                 .Items.Add(Angka)             Next         End With         With CmbTahun             Dim P As Integer = Year(Now) - 5     ...