Challenges storing collections value in Database

realone 0 Tallied Votes 134 Views Share

Hello All,

Can anybody help me, i am having challenges getting collections value into the database

Here is my sample code. but is not working at all rather is crashing the applications

Dim collections As New System.Enrolment.CustomerBiometricsCollection()
collections = Me.PrintCaptureWizard1.ShowDialog()
Dim dbs As New DBClass
Dim mee As String
mee = dbs.ConnectionString
Dim conn As New SqlClient.SqlConnection(mee)
conn.Open()
Dim ds As New SqlCommand("Custoon", conn)
ds.CommandType = CommandType.StoredProcedure
ds.CommandText = "CustBiometrics"
For k As Integer = 0 To collections.Count - 1
ds.Parameters.Add("@TemplateID", SqlDbType.UniqueIdentifier).Value = New Guid(TextBox1.Text)
ds.Parameters.Add("@TemplateIdentifierID", SqlDbType.UniqueIdentifier).Value = (collections(0).TemplateId)
ds.Parameters.Add("@CustomerID", SqlDbType.UniqueIdentifier).Value = New Guid(id)
ds.Parameters.Add("@Template", SqlDbType.Image).Value = collections(0).PrintTemplate
ds.Parameters.Add("@TemplateSize", SqlDbType.Int).Value = collections(0).Size
Dim dr As SqlDataReader = ds.ExecuteReader()
dr.Close()
Next k
conn.Close()
MessageBox.Show("Record Inserted")

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.