Insert,Update,Delete In VB 2010

Hello guys this is my sample database manipulation, using the 3 basic transaction, the
INSERT, UPDATE and DELETE like shown at the image below.









INSERT:

Dim rs As New OleDb.OleDbCommand("Insert INTO Info(F_Name,M_O
,SSS,Phic,Pagibig,Tax,Net_Inc) VALUES ('" &
StrConv(TextBox2.Text, VbStrConv.Uppercase) & "','" & (TextBox3.Text) & "','" &
 (TextBox4.Text) & "','" & (TextBox5.Text) & "','" & (TextBox6.Text) & "','" &
 (TextBox7.Text) & "','" & (TextBox8.Text) & "')", con)

UPDATE:

Dim rs As New OleDb.OleDbCommand("Update  Info Set F_Name='" & StrConv
(TextBox2.Text, VbStrConv.Uppercase) &  "',M_O='" & (TextBox3.Text) & "',
SSS='" & (TextBox4.Text) & "',Phic='" & (TextBox5.Text) & "',Pagibig='" & 
(TextBox6.Text) & "',Tax='" & (TextBox7.Text) & "',Net_Inc='" & (TextBox8.Text) 
& "'  WHERE ID_Num =" & id & "", con)

DELETE:

Dim rs As New OleDb.OleDbCommand("DELETE FROM Info WHERE
ID_Num = " & id & "", con)



Hope this will help ^_^
Happy Coding  ^_^
The Hardest Thing to Do is to Do Nothing ^_^   
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

OLEDB EXCEPTION WAS UNHANDLED

Hello guys have a good day to all who is reading this article, go back in the problem " oledb 
exception was unhandled " i encounter this type of problem when i worked at the database
this little error will prompt to me,and i wonder why this error will come out,i double check
every single of my code then i found out the only problem is the  spelling of a column name
on my database instead of ID_Num i wrote only ID, after changing the code to the respective
syntax , the program works fine and saved my day.

Note: 
         Not only Mis-Spelled variable or column name on
         your database but also when you are typing the Reserved 
         words of Visual Basic 2010 will get you on trouble like this.

Happy Coding ^_^
The Hardest Thing to DO is to Do Nothing ^_^
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

How to Connect MS Acess Database to VB 2010

Hello guys,at this time i will show to you on how to connect a MS Access Database on 
Visual  Basic 2010, make sure that your database is inside of the Debug Folder created by 
Visual Basic 2010,then the codes will look like this:

Public Class Form1

 Dim con As New OleDb.OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;
Data Source = |DataDirectory|\Panoy.mdb;")

End Class

first you must establish the connection and set the Provider, to Microsoft.Jet.OLEDB.4.0,
and the Data Source, this is your Database Path or Directory, 

Note: |DataDirectory|\Panoy.mdb; this is your database correct path coonection
,|DataDirectory| is the replacement of App.Path on VB 6.0;

Happy Coding ^_^
The Hardest Thing to DO is to Do Nothing ^_^
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

How to Create a Timer in VB2010


This is the very basic way on how to code or create your own timer using VB 2010, you must
add 2 Labels Control and 1 Timer control and also a 3 command button for you Handle whether
you want to start,stop and reset
















So this is the main code for you set up and get the output shown  in the image above, i used
the very basic Nested IF structure
.
 CODE:
 Place at the Timer1_Tick Event
Dim Uno, Dos As Integer

        Uno = "00"
        Dos = "09"

If Val(Label2.Text) >= Uno And Val(Label2.Text) < Dos Then
  Label2.Text = "0" & Val(Label2.Text) + 1      
   ElseIf Val(Label2.Text) = "59" Then
     If Val(Label1.Text) >= Uno And Val(Label1.Text) < Dos Then
         Label1.Text = "0" & Val(Label1.Text) + 1
         Label2.Text = "00"
      ElseIf Val(Label1.Text) = "11" And Val(Label2.Text) = "59" Then
          Label1.Text = "00"
          Label2.Text = "00"
       Else
         Label1.Text = Val(Label1.Text) + 1
       End If
  Else
       Label2.Text = Val(Label2.Text) + 1 
 End If

Download sample


Happy Coding ^_^
The Hardest Thing to Do is to Do Nothing
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

How to Create a Slot Machine using VB2010

This is my first sample program using Visual Basic 2010 because
i want to upgrade to Vb2010 from Vb6.0 and i hope you like it,
this is a Simple program that generate 3 Random Numbers on a
label control,and compute the price on each combination,on this
program i used the Calling method,the Val function,If and Else
Statement,the simple use of Link Label: to download this file just
follow this link SlotMachineNiAdrianPanoy























Happy Coding (^_^)
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

How to Generate Random Numbers in Vb2010

Generating Random Numbers in Visual Basic 2010 is similar on how to Generate Random
Numbers in Visual Basic 6.0, first you must add 1 button and 3 labels on the form then create
a Sub Procedures named Randomize that shown in the code below:

'place this code on your button click event
Call Randomize

Sub Randomize() 'this is your random number generator
        lbl1.Caption = CStr(Int(Rnd() * 10))
        lbl2.Caption = CStr(Int(Rnd() * 10))
        lbl3.Caption = CStr(Int(Rnd() * 10))
End Sub

The Hardest Thing to Do is to Do Nothing
Happy Coding (^_^)
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Copyright @ Codes-47.Blogspot.Com. Powered by Blogger.