Imports System.Data.SqlClient Imports System.Data Imports Microsoft.AspNet.Identity Imports Microsoft.AspNet.Identity.EntityFramework Imports Microsoft.AspNet.Identity.Owin Imports System.Linq Imports System.Web Imports System.Web.UI Imports Microsoft.Owin.Security Imports System.Runtime.InteropServices Partial Class PatientMedicationHistory Inherits System.Web.UI.Page 'Dim txtPatientName As New TextBox ' Dim txtPatientID As New TextBox ' Dim txtDOB As New TextBox Dim intZero As Integer Dim SQLCONN As New SqlConnection Dim SQLCMD As New SqlCommand Dim TempHistoryData As New DataTable() Protected Sub btEnterKey_Click(sender As Object, e As EventArgs) Handles btEnterKey.Click 'check if temp table has data... This does no work always shows if intZero > 0 SQLCMD.CommandText = "" SQLCMD.CommandType = CommandType.Text SQLCMD.CommandText = "Select " SQLCMD.CommandText = SQLCMD.CommandText & "intZero" SQLCMD.CommandText = SQLCMD.CommandText & " = COUNT(*) from TempHistoryData" If txtPatientID.Value <> "" Then SQLCMD.CommandText = SQLCMD.CommandText & " Where TempHistoryData.PatientID = '" & txtPatientID.Value & "'" ElseIf txtPatientName.Value <> "" Then SQLCMD.CommandText = SQLCMD.CommandText & " Where TempHistoryData.PatientName = '" & txtPatientName.Value & "'" End If Try SQLCMD.ExecuteNonQuery() Catch ex As Exception RecordErr.Text = "Recount Error intZero" RecordErr.Visible = True SQLCONN.Close() Exit Sub End Try If (intZero > 0) Then 'Populate Patient Medication History Screen... No data shows in text boxes and gridview does not show on web page txtPatientID.Value = TempHistoryData("PatientID").ToString() txtPatientName.Value = TempHistoryData("PatientName").ToString() txtDOB.Value = TempHistoryData("DateOfBirth").ToString() GridView1.DataSource = TempHistoryData GridView1.DataBind() Else RecordErr.Text = "intZero Error" RecordErr.Visible = True SQLCONN.Close() Exit Sub End If SQLCONN.Close() Else RecordErr.Text = "Record Not Found" RecordErr.Visible = True End If End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)