K
Kenneth
Can anyone explain me why it is neccesary to include SqlDbType to the
SqlParameter. In every example I see, it is done, but no one explaines
why.
I have for example a date I want to save into my Sql Server database
through a stored procedure-call. In the database it is defined as a
SmallDateTime. Every 3 methods in the client-code below gives the same
(and correct) result. So why is it that important?
dim param As SqlParameter
1. param = New SqlParameter("@DOB", SqlDbType.SmallDateTime)
param.Value = textboxDOB
2. param = New SqlParameter("@DOB", SqlDbType.DateTime)
param.Value = textboxDOB
3. param = New SqlParameter()
param.ParameterName = "@DOB"
param.Value = textboxDOB
It also seem annoying that every time I make a change in the database
(eg varchar(50) to varchar(100)), I have to check all my
Sqlparameters. Is there a way to read these definitions from the
stored procedure into the Sqlparameters?
SqlParameter. In every example I see, it is done, but no one explaines
why.
I have for example a date I want to save into my Sql Server database
through a stored procedure-call. In the database it is defined as a
SmallDateTime. Every 3 methods in the client-code below gives the same
(and correct) result. So why is it that important?
dim param As SqlParameter
1. param = New SqlParameter("@DOB", SqlDbType.SmallDateTime)
param.Value = textboxDOB
2. param = New SqlParameter("@DOB", SqlDbType.DateTime)
param.Value = textboxDOB
3. param = New SqlParameter()
param.ParameterName = "@DOB"
param.Value = textboxDOB
It also seem annoying that every time I make a change in the database
(eg varchar(50) to varchar(100)), I have to check all my
Sqlparameters. Is there a way to read these definitions from the
stored procedure into the Sqlparameters?