Archives

Create Database and Tables in SQL Server using VB.Net

Option Strict Off Option Explicit On Friend Class frmSQL Inherits System.Windows.Forms.Form #Region “Windows Form Designer generated code ” Public Sub New() MyBase.New() If m_vb6FormDefInstance Is Nothing Then If m_InitializingDefInstance Then m_vb6FormDefInstance = Me Else Try ‘For the start-up form, the first instance created is the default instance. If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then m_vb6FormDefInstance = Me […]

Rate this:

Read More

Storing images as BLOB in db in VB.Net

Private Sub UploadedFiles_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles UploadedFiles.DoubleClick ‘ ‘ Downloads the selected file and displays it in the picture box. ‘ ‘ ‘ Finds the unique id of the file. ‘ Dim drv As DataRowView = CType(UploadedFiles.SelectedItem, DataRowView) Dim selectedText As String = drv.Row(“Name”).ToString() Dim id As Long=-1 ‘ ‘ […]

Rate this:

Read More

Connect to Datasource in VB.Net

Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click Try ConnectionString = “Data Source= ” + txtdatasource.Text + “;Initial Catalog=” + txtinitialcat.Text + “;Integrated Security=SSPI;User ID=sa;Password=test;Connection Timeout=60” MessageBox.Show(ConnectionString) Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub

Rate this:

Read More

Update Fact tables for Data Warehouse in VB.Net

Private Sub btnUpdateFact_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdateFact.Click try Dim sqlupdatetable As String Dim counter As Integer counter = 0 If (btnUpdateFact.Text = “Update Facts”) Then btnAddFact.Enabled = False If (cbFTableName.SelectedIndex = -1) Then MessageBox.Show(“Please select a Table Name to update”, “Information”, MessageBoxButtons.OK, MessageBoxIcon.Information) Exit Sub End If cmd.Connection = New […]

Rate this:

Read More

Create Fact Tables for Data Warehouse in VB.Net

Private Sub btnCreateFact_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateFact.Click Try Dim tblerror As String tblerror = “” If (cbFTableName.SelectedIndex = -1) Then tblerror = “Please select a Table Name” End If If ((tblerror.Length > 0)) Then MessageBox.Show(tblerror + vbCrLf, “Information”, MessageBoxButtons.OK, MessageBoxIcon.Information) Exit Sub End If cmd.Connection = New System.Data.SqlClient.SqlConnection(ConnectionString) cmd.Connection.Open() sql […]

Rate this:

Read More

Update Dimensions Table for Data Warehouse in VB.Net

Private Sub btnUpdateDim_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdateDim.Click Try Dim sqlupdatetable As String Dim counter As Integer counter = 0 If (btnUpdateDim.Text = “Update Dimensions”) Then btnAdd.Enabled = False txtUnique.Enabled = False cbTypeUnique.Enabled = False txtPK.Enabled = False txtValUnique.Enabled = False If (cbTableName.SelectedIndex = -1) Then MessageBox.Show(“Please select a Table Name […]

Rate this:

Read More

Create Dimension Tables for Data Warehouse in VB.Net

Private Sub btnCreateDim_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateDim.Click Try Dim tblerror, unqerror, pkerror, valerror As String tblerror = “” unqerror = “” pkerror = “” valerror = “” Dim sqlcmd As System.Data.SqlClient.SqlCommand Dim sqladd As System.Data.SqlClient.SqlCommand If (cbTableName.SelectedIndex = -1) Then tblerror = “Please select a Table Name” End If If […]

Rate this:

Read More