Re: SqlCeParameter Issues NullReferenceExeception
From: Enver A (ea90_at_hotmail.com)
Date: 06/21/04
- Next message: Rob Hughes: "Re: CreateProcess/WaitForSingleObject problem"
- Previous message: Romu: "RE: about vs.net2003 or above"
- In reply to: Brett Miller: "SqlCeParameter Issues NullReferenceExeception"
- Next in thread: Ilya Tumanov [MS]: "RE: SqlCeParameter Issues NullReferenceExeception"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 21 Jun 2004 16:58:44 +0300
I use this and it works just fine
here is the code
Dim PARAM1 As String
Dim PARAM2 As String
command.CommandText = "INSERT INTO ARACLAR (INDEXARC,ARCMARKA) VALUES(?,?)
PARAM1 = "00001"
PARAM2 = "ALFA ROMEO"
command.Parameters.Add("@INDEXARC", PARAM1)
command.Parameters.Add("@ARCMARKA", PARAM2)
command.prepare()
command.executenonquery()
iller" <brett@NOSPAMpsion.co.za> wrote in message
news:OJ0gIC5VEHA.2844@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> I have created a SQLServerCE database table with 22 fields, I have a
> parameterised INSERT Query, that looks something like this
>
> CDisplay.CommandText = "INSERT INTO CDisplay ( " &
> _"Status,LstTiPNo,CC,LastVisitDate
> ,CUniq,Indics,CallKey,SeqNo,TelNo,TelExtn," &
>
_"NIndic,BPO,D1,LegalName,SBLKey,Comment,Contact1,StNo,DspAddr,Descr1,Descr2
> ,PrvComp1) " & _"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
>
> The Parameters are setup like this...
>
> CDisplay.Parameters.Add(New SqlCeParameter("Status", SqlDbType.Int))
>
> CDisplay.Parameters(0).IsNullable = True
>
> This is done for each field...
>
> I read records from a BinaryStream, and populate the parameters with the
> respective values, sometime I do not get values for every field before I
> reach the next record.
>
> When I call
>
> CDisplay.ExecuteNonQuery()
>
> I get a NullReferenceExeception from the topmost Parameter that I did'nt
> have a value for...
>
> Why is this happening???? isn't IsNullable enough???
>
> Thanks 4 u're Help.
>
> BM
>
>
>
>
>
- Next message: Rob Hughes: "Re: CreateProcess/WaitForSingleObject problem"
- Previous message: Romu: "RE: about vs.net2003 or above"
- In reply to: Brett Miller: "SqlCeParameter Issues NullReferenceExeception"
- Next in thread: Ilya Tumanov [MS]: "RE: SqlCeParameter Issues NullReferenceExeception"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|