GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  Programming  >  VB.NET
Go To First  |  Previous Question  |  Next Question 
 VB.NET  |  Question 226 of 333    Print  
How to assign and retrive values from array, arraylist dynamically........please see the question

Will enter the number of values to be inserted into array in one text box
ex: n= txt_num.text
and from another textbox I want to insert the 'n' values(ie varchar values)
and then i want to retrive the values back such that i can use these values in select stmt of T-sql to retrive the data....

and i want to display the data of all 'n' values in one table

*here is the code.. for assigning and retriving pl chk this is the main prob...
i can write T-sql part..........please help

Imports System.Data.SqlClient
Imports System.Drawing

Public Class compare
Dim n, i As Integer
Dim compareDS As DataSet
Dim compvar(i) As ArrayList
Dim conn As SqlConnection
Dim cmd As SqlCommand

Dim DA As SqlDataAdapter


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

conn = New SqlConnection("server=acer;initial catalog=breakdiskprocessdata;integrated security=sspi")
conn.Open()
cmd = New SqlCommand
Dim InsertString1 As String
Dim txt_batchno(i) As TextBox
txt_batchno(i) = New TextBox
'txt_batchno(n).Text = txtbatchno.Text

n = txt_nos.Text

' For i = 0 To i = n - 1
'compvar(i) = txtbatchno.Text

' Next
' MsgBox("value of compvar(i)" & compvar(i).Item(i))
'MsgBox("value of compvar(i)" & compvar(1))
'For i = 0 To i = n - 1
i = 0
' If i <= n - 1 Then
' MsgBox("value of compvar(i)" compvar(i))
compvar(i).Item(i) = New ArrayList
Dim s1 As String
txt_batchno(i).ext = compvar(i).Item(i)
s1 = compvar(i).Add(txt_batchno(i).Text)
' MsgBox("value of compvar(i)" & compvar(i).Item(i))
txt_batchno(i).Text = s1 'compvar(i)compvar(i).Item(i).ToString
InsertString1 = "select * from brakedisc_info where batchno='" & txt_batchno(i).Text & "'" ' and batchno='" & txt_batchno(i + 1).Text & "'"
compareDS = New DataSet("compare")
DA = New SqlDataAdapter(InsertString1, conn)
DA.Fill(compareDS, "brakedisc_info")
DataGridView1.DataSource = compareDS.Tables(0)
'i = i + 1
' End If
'Next

End Sub

Private Sub btn_add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_add.Click
conn = New SqlConnection("server=acer;initial catalog=breakdiskprocessdata;integrated security=sspi")
conn.Open()
n = txt_nos.Text
Dim InsertString1, s1 As String
Dim txt_batchno(i) As TextBox
txt_batchno(i) = New TextBox
Dim flag As Boolean
flag = True
i = 0
compvar(i) = New ArrayList
'For i = 0 To i = n - 1
If flag = True Then

If i <= n - 1 Then
compvar(i).Insert(i, txtbatchno.Text)
txtbatchno.Text = ""
Me.Show()
MsgBox("array contains:" & compvar(i).Item(i))
i = i + 1
End If

End If
' Next
' If i <= n - 1 Then
'flag = False
' If flag = False Then
'InsertString1 = "select * from brakedisc_info where batchno='" & txt_batchno(i).Text & "'" ' and batchno='" & txt_batchno(i + 1).Text & "'"
'MsgBox("value of compvar(i)" & compvar(i).Item(i))
' txt_batchno(i).Text = compvar(i).Item(i)
' InsertString1 = "select * from brakedisc_info where batchno='" & txt_batchno(i).Text & "'" ' and batchno='" & txt_batchno(i + 1).Text & "'"
' compareDS = New DataSet("compare")
' DA = New SqlDataAdapter(InsertString1, conn)
' DA.Fill(compareDS, "brakedisc_info")
' DataGridView1.DataSource = compareDS.Tables(0)
' End If
' End If
End Sub
End Class

Thanks in advance...

  
Total Answers and Comments: 1 Last Update: July 25, 2006     Asked by: vraju123 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 25, 2006 07:51:10   
Vishal Verma        

RE: How to assign and retrive values from array, array...
use the Lines(index) array which is a feature or textbox to retreive lines seperatly from textbox
 
Is this answer useful? Yes | No

 Related Questions

A) YesB) NoExplanation: The DLLs you created in VB.NET are assemblies that contain managed code 
Latest Answer : Yes. ...

A) CLRB) .NET Context ManagerC) CTS 
Latest Answer : A) CLR ( Common Language runtime or known as just 'runtime' )Any code that targets or uses CLR services is known as managed code.The .NET framework has two mejor component. CLR and FCL ( i.e. framework class library ) . CLR provides services such ...

A) IL CodeB) Native codeC) Byte Code 
Latest Answer : ans is IL or MSIL intermediate Language. ...

A) Generate Assembly language code from ILB) to display the contents of a .NET program fileC) to view the IL within individual functions 
Latest Answer : This is the .net dis assembler tool ...

A) YesB) No 
Latest Answer : A-Yes ...

A) A field always has Get and Set MethodsB) A property always has Get and Set MethodsC) None of the aboveExplanation: These methods are internally used set and retrieve values of a property. 
Latest Answer : ans cnone of the above ...

A) System.IOB) System.FileObjectsC) System.FileSystem 
Latest Answer : a) SYSTEM.IO ...

A) ArrayListB) HashTableC) DynamicArray 
Latest Answer : arraylist ...

A) assemblyname.logB) Applog.LogC) Application.LogExplanation: This file is located in the application’s data directory. 
Latest Answer : C) Application.Log ...

A) My.Computer.CurrentFolderB) My.Application.CurrentFolderC) My.System.CurrentFolder  
Latest Answer : My.Application.CurrentFolder ...


 Sponsored Links

 
Related Articles

Breaking up XML into Relational Data

Breaking up XML into Relational Data While the preceding example shows how to construct an XML representation over relational data the example in this section illustrates how you can shred XML data back into relational data This reverse operation can be useful if your application works with relation
 

Querying Data with Oracle XQuery

Querying Data with Oracle XQuery Starting with Oracle Database 10g Release 2 you can take advantage of a full featured native XQuery engine integrated with the database With Oracle XQuery you can accomplish various tasks involved in developing PHP Oracle XML applications operating on any kind of dat
 

Retrieving XML Data

Retrieving XML DataTo retrieve XML data from an XMLType table you can use a SELECT SQL statement just as you would if you had to query a relational table For example to select the employee with the id set to 100 from the employees XMLType table discussed in the preceding section you might issue the
 

Using XMLType for Handling XML Data in the Database

Using XMLType for Handling XML Data in the Database Being an object type XMLType can not only be used to store XML data in the database but also to operate on that data via its built in methods Regardless of the storage model you choose XMLType provides a set of XML specific methods to operate on XM
 

Using Oracle Database for Storing, Modifying, and Retrieving XML Data

Using Oracle Database for Storing Modifying and Retrieving XML Data With Oracle XML DB you have various XML storage and XML processing options allowing you to achieve the required level of performance and scalability One of the most interesting things about Oracle XML DB is that it allows you to per
 

ODP.NET - Techniques to Improve Performance while Retrieving Data

ODP NET Techniques to Improve Performance while Retrieving Data Performance tuning is a great subject in Oracle Volumes of books would not be enough to cover every aspect of performance tuning in Oracle However in this section we will only discuss the fundamental performance techniques while working
 

ODP.NET - OracleCommand Object

ODP NET More About the OracleCommand Object Till now we have seen OracleCommand working with OracleDataReader OracleCommand is not simply meant for OracleDataReader It has got a lot of functionality for itself Let us see few of the most commonly used features of OracleCommand in this section We will
 

ODP.NET - Presenting Master-Detail Information Using a Dataset

ODP NET Presenting Master Detail Information Using a Dataset As mentioned before a DataSet object can have its own relations between data tables existing in it We can add these relations dynamically at the client side within an application to represent master detail or hierarchical information The f
 

ODP.NET - Populating a Dataset with a Single Data Table

ODP NET Populating a Dataset with a Single Data Table A dataset is simply a group of data tables These data tables can be identified with their own unique names within a dataset You can also add relations between data tables available in a dataset mosgoogle The following code gives you the details o
 

ODP.NET - Retrieving Typed Data

ODP NET Retrieving Typed Data While retrieving values from OracleDataReader we can extract information available in individual columns of a particular row either by using column ordinal position values or column names mosgoogle Retrieving Typed Data Using Ordinals ODP NET provides data specific enum
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape