With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.
Public Sub FillList() With lvList .Clear() .View = View.Details .FullRowSelect = True .GridLines = True .Columns.Add("Key", 50) .Columns.Add("Rank", 90) .Columns.Add("Profession", 120) .Columns.Add("Lastname", 140) .Columns.Add("Firstname", 90) .Columns.Add("ASMA", 90) .Columns.Add("Squadron", 60) FillListView(lvList, cmd.ExecuteReader(CommandBehavior.CloseConnection)) End With End Sub 'where lvList my list view so what is next.... Dim conn As New SqlConnection(My.Settings.MyConnectionString) Dim query As String = "SELECT Key_Personnel,Rank, Profession,Lastname,Firstname,ASMA,Moira FROM Q_Personnel_1 WHERE id_Moira = '" & TextBox1.Text & "'",conn) 'Q_Personnel_1 is a view form sql server Dim cmd As New SqlCommand(query, conn) Private Sub PersonnelListView_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If conn.State = ConnectionState.Open Then conn.Close() conn.Open() Call FillList() End Sub The value from textbox1.text is a public variable that gives a value for id_Moira..(id_Moira is a particular office) the problem is in WHERE id_Moira = '" & TextBox1.Text & "'" statement... lets say the value of id_Moira in my textbox1.text is 2..... when i put WHERE id_Moira = '" & 2 & "'" i have results in my list view when i put WHERE id_Moira = '" & TextBox1.Text & "'" i have an unhandled null reference exception "Object reference not set to an instance of an object." could someone plz tell me why this happened?
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
17 Experts available now in Live!