if u want to create store procedure thn follow this
create procedure dbo.InsertPackageExtras<br />
(<br />
@vcPackageCode nvarchar(10),<br />
@inDays int,<br />
@inNights int,<br />
@txAllPlaceNames ntext,<br />
@btHaveImages bit,<br />
@btHaveMaps bit,<br />
@btHaveBanners bit,<br />
@vcCreatedBy nvarchar(255),<br />
@dtCreationDate datetime,<br />
@vcUpdatedBy nvarchar(255),<br />
@dtUpdationDate datetime,<br />
@txHistory ntext <br />
)<br />
AS<br />
BEGIN<br />
insert into PacakageExtras<br />
(<br />
vcPackageCode,<br />
inDays, <br />
inNights, <br />
txAllPlaceNames,<br />
btHaveImages, <br />
btHaveMaps, <br />
btHaveBanners, <br />
vcCreatedBy, <br />
dtCreationDate, <br />
vcUpdatedBy, <br />
dtUpdationDate, <br />
txHistory <br />
)<br />
values<br />
(<br />
@vcPackageCode, <br />
@inDays, <br />
@inNights, <br />
@txAllPlaceNames,<br />
@btHaveImages, <br />
@btHaveMaps , <br />
@btHaveBanners, <br />
@vcCreatedBy, <br />
@dtCreationDate, <br />
@vcUpdatedBy, <br />
@dtUpdationDate, <br />
@txHistory <br />
)<br />
end
and if u want to insert record into above store procedure thn follow this
SqlCommand sqlcmd = new SqlCommand("InsertPackageExtras", sqlconn);<br />
sqlcmd.CommandType = CommandType.StoredProcedure;<br />
sqlcmd.Parameters.Add("@vcPackageCode", SqlDbType.NVarChar).Value = PackageCode;<br />
<br />
<br />
sqlcmd.Parameters.Add("@inDays",SqlDbType.Int).Value = Days;<br />
sqlcmd.Parameters.Add("@inNights",SqlDbType.Int).Value=Nights;<br />
sqlcmd.Parameters.Add("@txAllPlaceNames",SqlDbType.NText).Value =AllPlaceNames;<br />
sqlcmd.Parameters.Add("@btHaveImages",SqlDbType.Bit).Value=HaveImages;<br />
sqlcmd.Parameters.Add("@btHaveMaps",SqlDbType.Bit).Value = HaveMaps;<br />
sqlcmd.Parameters.Add("@btHaveBanners",SqlDbType.Bit).Value =HaveBanners;<br />
sqlcmd.Parameters.Add("@vcCreatedBy",SqlDbType.NVarChar).Value="deepak"; <br />
sqlcmd.Parameters.Add("@dtCreationDate",SqlDbType.DateTime).Value= DateTime.Now;<br />
sqlcmd.Parameters.Add("@vcUpdatedBy",SqlDbType.NVarChar).Value="deepak";<br />
sqlcmd.Parameters.Add("@dtUpdationDate",SqlDbType.DateTime).Value=DateTime.Now;<br />
sqlcmd.Parameters.Add("@txHistory", SqlDbType.NText).Value = "history";<br />
sqlconn.Open();<br />
sqlcmd.ExecuteNonQuery();<br />
sqlconn.Close();
Deepak
Smile a Lots,Its Costs Nothing
|