Good to hear :-) You are welcome!
Cheers,
Daniel Walzenbach
"msnews.microsoft.com" <(E-Mail Removed)> schrieb im
Newsbeitrag news:%(E-Mail Removed)...
> Thank you to everyone that replied.
>
> When I tried to convert a value from a field in the dataset's table to
> byte,
> I got an error, because the implicit conversion wasn't allowed from an
> array
> (the default conversion sent back from the timestamp column).
>
> Thus, I went with Daniel's suggestion to convert the value to a BigInt
> within the retrieval stored procedure's select statement. That way, I can
> store the entire recordset in a dataset, when it is returned. Then, I
> send
> back the BigInt value to the stored procedure that tests for concurrency
> (for updates). This worked great.
>
> Thank you, Daniel!
>
> "Bari Allen" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I'm trying to test for concurrency, using a SQL Stored Procedure on a
>> RowVersion (timestamp) Field. The vb code I'm using is as follows
>>
>> Dim cmd As New SqlCommand("ConcurrencyCheck", cn)
>> Dim intID as integer = MyDataset.Tables("MyTable").Rows(0).Item("ID")
>> cmd.CommandType = CommandType.StoredProcedure
>> cmd.Parameters.Add("@ReturnValue", SqlDbType.Int)
>> cmd.Parameters(0).Direction = ParameterDirection.ReturnValue
>> cmd.Parameters.Add("@ID", intID)
>>
>> Dim concurParam As New SqlParameter
>> concurParam.ParameterName = "@Concurrency"
>> concurParam.Value =
>> MyDataset.Tables("MyTable").Rows(0).Item("ConcurrencyValue")
>> concurParam.SqlDbType = SqlDbType.Binary
>> cmd.Parameters.Add(concurParam)
>>
>> cn.Open()
>>
>> If cmd.ExecuteScalar() > 0 Then
>> Record Found ...
>> Else
>> Record not found ...
>> End If
>>
>> cmd.Dispose()
>> cn.Close()
>> cn.Dispose()
>>
>> Prior to submitting the form, I run a different stored procedure which
>> populates the "MyDataset" from the same row using:
>> SELECT * FROM MyTable WHERE ID = @ID
>>
>> The code in the stored procedure that submits the form is:
>> SELECT Count(*) FROM MyTable WHERE ID = @ID AND ConcurrencyValue =
>> @Concurrency
>>
>> How do I convert the originally retrieved data (RowVersion) back to a
>> true
>> binary in ASP.NET to send it back to SQL? It currently is storing the
> field
>> as an array, for some reason. Thus, when I test this procedure and now
>> (without a doubt) no one has modified the record since, it ALWAYS returns
>> "record not found"
>>
>> Thanks in advance for any help on this.
>>
>> Bari
>>
>>
>
>
|