C# SqlClient execute a stored procedure and return

  [code language=”cpp”]   using System.Data.SqlClient; namespace ImagingApp { public partial class frmDatabase : Form { public frmDatabase() { InitializeComponent(); } private void frmDatabase_Load(object sender, EventArgs e) { string connStr; connStr = "Data Source=ServerName;Initial Catalog=AdventureWorks2014;Persist Security Info=True;User ID=sa;Password=YourSecret"; SqlConnection db = new Read More

VB SqlClient Read data from database

[code language=”vb”] Imports System.Data.SqlClient Public Class frmDatabaseConn Public strSQLConn As String Private Sub frmDatabaseConn_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load strSQLConn = "Data Source=ServerName;Initial Catalog=AdventureWorks2014;Persist Security Info=True;User ID=sa;Password=YourSecret" ReadDataFromDB() End Sub Private Sub ReadDataFromDB() Dim sqlConn As New SqlConnection(strSQLConn) Dim cmd Read More

VB SqlClient Insert Data to database

  [code language=”vb”] Imports System.Data.SqlClient Public Class frmDatabaseConn Public strSQLConn As String Private Sub frmDatabaseConn_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load strSQLConn = "Data Source=ServerName;Initial Catalog=AdventureWorks2014;Persist Security Info=True;User ID=sa;Password=Your@Secret" End Sub Private Sub btnInsertPara_Click(sender As System.Object, e As System.EventArgs) Handles btnInsertPara.Click Read More

VB Simple Collision Detection

Private Sub CollisionDetect() LblGroupA_RE.Text = “—” LblGroupA_LE.Text = “—” LblGroupA_TC.Text = “—” LblGroupA_BC.Text = “—” If PicMe.Left < PicEnemy.Left AndAlso PicMe.Right > PicEnemy.Left Then If PicMe.Top < PicEnemy.Top AndAlso PicMe.Bottom > PicEnemy.Bottom Then LblGroupA_RE.Text = “Right is Attacked” Timer1.Enabled = False End Read More

VB IntersectsWith

Private Sub IntersectCheck() ‘PictureBox 1 VS PictureBox 2 If PicMe.Bounds.IntersectsWith(PicEnemy.Bounds) Then LblGroupA.Text = “Collision” Else LblGroupA.Text = “No Contact” End If If PictureBox3.Bounds.IntersectsWith(PictureBox4.Bounds) Then lblGroupB.Text = “Collision” Else lblGroupB.Text = “No Contact” End If ‘Picture 4 VS All For Each PictureBox In Read More