Unable To Insert Data To Database

Mar 25, 2008

HI all

I've used textboxes to insert data to database but when i click save button everything is ok but when i check in the database the values are null evrywhere below is my code. i am trying to save to different databases pls help!!

</table>

 

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; width: 157%; height: 32px;" bordercolor="#111111">

<tr><td width="100%" colspan="6" bgcolor="#eeeddb" align="center" style="height: 36px">

</td><tr>

<tr><td width="100%" colspan="6" bgcolor="#ffcc33" align="center" style="height: 41px">

<font color="#000000">Passenger's Details</font></td><tr>

 

<td bgcolor="#eeeddb" style="width: 164px; height: 16px;">Surname</td>

<td bgcolor="#eeeddb" style="width: 160px; height: 16px;">

Name</td>

<td bgcolor="#eeeddb" style="width: 129px; height: 16px;">

Initials</td>

<td bgcolor="#eeeddb" style="width: 17%; height: 16px;">

Title</td>

<td bgcolor="#eeeddb" style="width: 148px; height: 16px;">

Tel</td>

<td bgcolor="#eeeddb" style="width: 234px; height: 16px;">

Fax</td>

 

</tr>

<tr>

<td style="width: 164px">

<asp:TextBox ID="TextBox21" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 160px">

<asp:TextBox ID="TextBox22" runat="server" Enabled="False"></asp:TextBox></td>

<td>

<asp:TextBox ID="TextBox24" runat="server" Enabled="False"></asp:TextBox></td>

<td>

<asp:TextBox ID="TextBox26" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 148px">

<asp:TextBox ID="TextBox27" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 234px">

<asp:TextBox ID="TextBox28" runat="server" Enabled="False"></asp:TextBox></td>

</tr>

<tr>

<td bgcolor="#eeeddb" style="width: 164px; height: 16px;">Frequent Flyer Number</td>

<td bgcolor="#eeeddb" style="width: 160px; height: 16px;">

Seating Preference</td>

</tr>

<tr><td style="width: 164px">

<asp:TextBox ID="TextBox54" runat="server" Enabled="False"></asp:TextBox></td><td style="width: 160px">

<asp:TextBox ID="TextBox55" runat="server" Enabled="False"></asp:TextBox></td></tr>

</table>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; width: 157%;" bordercolor="#111111" height="32">

<tr><td width="100%" colspan="7" bgcolor="#eeeddb" align="center" style="height: 32px">

</td><tr>

<tr><td width="100%" colspan="7" bgcolor="#ffcc33" align="center" style="height: 37px">

<font color="#000000">Flight's Details</font></td>

</tr>

<tr>

<tr >

<td bgcolor="#eeeddb" style="width: 154px;" height="16">

Routing:</td>

<td style="width: 151px" bgcolor="#eeeddb" height="16" >

From</td>

<td style="width: 14%" bgcolor="#eeeddb" height="16">

To</td>

<td bgcolor="#eeeddb" style="width: 17%;" height="16" >

Dept Time</td>

<td style="width: 148px" bgcolor="#eeeddb" height="16">

Arriv Time</td>

<td style="width: 227px" bgcolor="#eeeddb" height="16" >

Flight</td>

<td bgcolor="#eeeddb" height="16" style="width: 137px" >

Class</td>

</tr>

 

<tr>

<td style="width: 154px">

<asp:Label ID="Label16" runat="server" Enabled="False" Font-Bold="True" Text="Leg 1"></asp:Label></td>

<td style="width: 151px">

<asp:TextBox ID="TextBox38" runat="server" Width="120px" Enabled="False"></asp:TextBox></td>

<td>

<asp:TextBox ID="TextBox41" runat="server" Enabled="False"></asp:TextBox></td>

<td>

<asp:TextBox ID="TextBox44" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 148px">

<asp:TextBox ID="TextBox47" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 227px">

<asp:TextBox ID="TextBox35" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 137px">

<asp:TextBox ID="TextBox82" runat="server" Enabled="False"></asp:TextBox></td></tr>

<tr>

<td style="width: 154px">

<asp:Label ID="Label5" runat="server" Enabled="False" Font-Bold="True" Text="Leg 2"></asp:Label></td>

<td style="width: 151px">

<asp:TextBox ID="TextBox39" runat="server" Width="120px" Enabled="False"></asp:TextBox></td>

<td>

<asp:TextBox ID="TextBox43" runat="server" Enabled="False"></asp:TextBox></td>

<td>

<asp:TextBox ID="TextBox45" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 148px">

<asp:TextBox ID="TextBox48" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 227px">

<asp:TextBox ID="TextBox36" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 111px">

<asp:TextBox ID="TextBox83" runat="server" Enabled="False"></asp:TextBox></td></tr>

<tr>

<td style="width: 154px; height: 25px;">

<asp:Label ID="Label8" runat="server" Enabled="False" Font-Bold="True" Text="Leg 3"></asp:Label></td>

<td style="width: 151px; height: 25px;">

<asp:TextBox ID="TextBox40" runat="server" Width="120px" Enabled="False"></asp:TextBox></td>

<td style="height: 25px">

<asp:TextBox ID="TextBox42" runat="server" Enabled="False"></asp:TextBox></td>

<td style="height: 25px">

<asp:TextBox ID="TextBox46" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 148px; height: 25px;">

<asp:TextBox ID="TextBox49" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 227px; height: 25px;">

<asp:TextBox ID="TextBox37" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 137px; height: 25px;">

<asp:TextBox ID="TextBox84" runat="server" Enabled="False" Height="14px" Width="147px"></asp:TextBox></td></tr>

</table>

 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; width: 157%;" bordercolor="#111111" height="32" id="TABLE2">

<tr><td width="100%" colspan="6" bgcolor="#eeeddb" align="center" style="height: 38px">

</td><tr><tr>

<td colspan="7" bgcolor="#ffcc33" align="center" style="height: 37px; width: 107%;"><font color="#000000">Accomodation's Details</font></td>

</tr><tr>

<td bgcolor="#eeeddb" style="width: 41px; height: 29px;">Routing:</td>

<td bgcolor="#eeeddb" style="width: 76px; height: 29px;">

Hotel Name</td>

<td bgcolor="#eeeddb" style="width: 14%; height: 29px;">

Check-in Date</td>

<td bgcolor="#eeeddb" style="width: 17%; height: 29px;">

Check-out Date</td>

<td bgcolor="#eeeddb" style="width: 113px; height: 29px;">

Room Type</td>

<td bgcolor="#eeeddb" style="width: 113px; height: 29px;">Included</td>

</tr>

<tr>

<td style="width: 41px; height: 31px;">

<asp:Label ID="Label9" runat="server" Enabled="False" Font-Bold="True" Text="Leg 1"></asp:Label></td>

<td style="width: 76px; height: 31px;">

<asp:TextBox ID="TextBox30" runat="server" Enabled="False"></asp:TextBox></td>

<td style="height: 31px">

<asp:TextBox ID="TextBox50" runat="server" Enabled="False"></asp:TextBox></td>

 

<td style="width: 148px; height: 31px;">

<asp:TextBox ID="TextBox53" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 232px; height: 31px;">

<asp:TextBox ID="TextBox29" runat="server" Enabled="False"></asp:TextBox></td>

<td>

<asp:TextBox ID="TextBox85" runat="server" Enabled="False"></asp:TextBox>

</td>

</tr>

<tr>

<td style="width: 41px; height: 26px">

<asp:Label ID="Label10" runat="server" Enabled="False" Font-Bold="True" Text="Leg 2"></asp:Label></td>

<td style="width: 76px; height: 26px">

<asp:TextBox ID="TextBox33" runat="server" Enabled="False"></asp:TextBox></td>

<td style="height: 26px">

<asp:TextBox ID="TextBox51" runat="server" Enabled="False"></asp:TextBox></td>

<td style="height: 26px">

<asp:TextBox ID="TextBox56" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 148px; height: 26px;">

<asp:TextBox ID="TextBox31" runat="server" Enabled="False"></asp:TextBox></td>

 

<td>

<asp:TextBox ID="TextBox86" runat="server" Enabled="False"></asp:TextBox>

</td></tr>

<tr>

<td style="height: 20px; width: 41px;">

<asp:Label ID="Label11" runat="server" Enabled="False" Font-Bold="True" Text="Leg 3"></asp:Label></td>

<td style="height: 20px; width: 76px;">

<asp:TextBox ID="TextBox32" runat="server" Enabled="False"></asp:TextBox></td>

<td style="height: 20px">

<asp:TextBox ID="TextBox52" runat="server" Enabled="False"></asp:TextBox></td>

<td style="height: 20px">

<asp:TextBox ID="TextBox57" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 148px; height: 20px;">

<asp:TextBox ID="TextBox34" runat="server" Enabled="False"></asp:TextBox></td>

 

<td>

<asp:TextBox ID="TextBox87" runat="server" Enabled="False"></asp:TextBox>

</td></tr>

 </table>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; width: 157%;" bordercolor="#111111" height="32" id="TABLE3">

<tr><td width="100%" colspan="6" bgcolor="#eeeddb" align="center" style="height: 38px">

</td><tr><tr>

<td colspan="7" bgcolor="#ffcc33" align="center" style="height: 37px; width: 107%;"><font color="#000000">Vehicle's Details</font></td>

</tr><tr>

<td bgcolor="#eeeddb" style="width: 130px; height: 26px;">Company</td>

<td bgcolor="#eeeddb" style="width: 20%; height: 26px;">

Group</td>

<td bgcolor="#eeeddb" style="width: 129px; height: 26px;">

Pick-up Date</td>

<td bgcolor="#eeeddb" style="width: 17%; height: 26px;">

Pick-up Time</td>

<td bgcolor="#eeeddb" style="width: 113px; height: 26px;">Pick-up Addresss</td>

</tr><tr>

<td style="height: 20px">

<asp:TextBox ID="TextBox58" runat="server" Width="169px" Enabled="False"></asp:TextBox></td>

<td style="height: 20px">

<asp:TextBox ID="TextBox59" runat="server" Width="163px" Enabled="False"></asp:TextBox></td>

<td style="height: 20px">

<asp:TextBox ID="TextBox61" runat="server" Enabled="False"></asp:TextBox>

</td>

 

<td style="height: 20px">

<asp:TextBox ID="TextBox62" runat="server" Enabled="False"></asp:TextBox>

</td>

 

<td style="height: 20px">

<asp:TextBox ID="TextBox60" runat="server" Enabled="False"></asp:TextBox></td>

</tr><tr>

<td style="height: 22px">

<asp:TextBox ID="TextBox63" runat="server" Width="169px" Enabled="False"></asp:TextBox></td>

<td style="height: 22px">

<asp:TextBox ID="TextBox64" runat="server" Width="163px" Enabled="False"></asp:TextBox></td>

<td style="height: 22px">

<asp:TextBox ID="TextBox65" runat="server" Enabled="False"></asp:TextBox>

</td>

 

<td style="height: 22px">

<asp:TextBox ID="TextBox66" runat="server" Enabled="False"></asp:TextBox>

</td>

 

<td style="height: 22px">

<asp:TextBox ID="TextBox67" runat="server" Enabled="False"></asp:TextBox></td>

</tr><tr>

<td style="height: 20px">

<asp:TextBox ID="TextBox68" runat="server" Width="169px" Enabled="False"></asp:TextBox></td>

<td style="height: 20px">

<asp:TextBox ID="TextBox69" runat="server" Width="163px" Enabled="False"></asp:TextBox></td>

<td style="height: 20px">

<asp:TextBox ID="TextBox70" runat="server" Enabled="False"></asp:TextBox>

</td>

 

<td style="height: 20px">

<asp:TextBox ID="TextBox71" runat="server" Enabled="False"></asp:TextBox>

</td>

 

<td style="height: 20px">

<asp:TextBox ID="TextBox72" runat="server" Enabled="False"></asp:TextBox></td>

</tr>

<tr>

<td bgcolor="#eeeddb" style="width: 14%; height: 16px;">

Drop-off Date</td>

<td bgcolor="#eeeddb" style="width: 17%; height: 16px;">

Drop-off Time</td>

<td bgcolor="#eeeddb" style="width: 129px; height: 16px;">Drop-off Addresss</td></tr>

<tr><tr>

<td><asp:TextBox ID="TextBox74" runat="server" Enabled="False"></asp:TextBox>

</td>

<td>

<asp:TextBox ID="TextBox75" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 129px"><asp:TextBox ID="TextBox73" runat="server" Width="183px" Enabled="False"></asp:TextBox></td>

 

 </tr>

<tr>

<td style="height: 19px"><asp:TextBox ID="TextBox76" runat="server" Enabled="False"></asp:TextBox>

</td>

<td style="height: 19px">

<asp:TextBox ID="TextBox77" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 129px; height: 19px;"><asp:TextBox ID="TextBox78" runat="server" Width="183px" Enabled="False"></asp:TextBox></td>

 

 </tr>

<tr>

<td><asp:TextBox ID="TextBox79" runat="server" Enabled="False"></asp:TextBox>

</td>

<td>

<asp:TextBox ID="TextBox80" runat="server" Enabled="False"></asp:TextBox></td>

<td style="width: 129px"><asp:TextBox ID="TextBox81" runat="server" Width="183px" Enabled="False"></asp:TextBox></td>

 

 </tr>

</table><table>

<tr>

 

<td style="width: 731px">

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

&nbsp; &nbsp;

<br />

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

<br />

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

&nbsp;<asp:Button id="Button5" Text="Previous step" OnClick="PrevStep" runat="server"/>&nbsp; &nbsp; &nbsp; &nbsp;

&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<asp:Button ID="Save" runat="server" Text="Save" />

&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<input id="Button3" hidefocus="hidefocus" onclick="printpage(this)" type="button" value="Print" />

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

 

<input id="Button4" onclick="exit()" type="button" value="Cancel" /></td>

 

 </tr>

</table>

 </asp:Panel>

 

<!--/fieldset-->

 

</div>

<br />

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Travel BookingConnectionString7 %>"

DeleteCommand="DELETE FROM [Accomodation] WHERE [AccID] = @AccID" InsertCommand="INSERT INTO [Accomodation] ([Routing], [Hotel Name], [Check in date], [Check out date], [Included], [Room Type]) VALUES (@Routing, @Hotel_Name, @Check_in_date, @Check_out_date, @Included, @Room_Type)"

SelectCommand="SELECT [AccID], [Routing], [Hotel Name] AS Hotel_Name, [Check in date] AS Check_in_date, [Check out date] AS Check_out_date, [Included], [Room Type] AS Room_Type FROM [Accomodation]"

UpdateCommand="UPDATE [Accomodation] SET [Routing] = @Routing, [Hotel Name] = @Hotel_Name, [Check in date] = @Check_in_date, [Check out date] = @Check_out_date, [Included] = @Included, [Room Type] = @Room_Type WHERE [AccID] = @AccID">

<DeleteParameters>

<asp:Parameter Name="AccID" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="Routing" Type="String" />

<asp:Parameter Name="Hotel_Name" Type="String" />

<asp:Parameter Name="Check_in_date" Type="String" />

<asp:Parameter Name="Check_out_date" Type="String" />

<asp:Parameter Name="Included" Type="String" />

<asp:Parameter Name="Room_Type" Type="String" />

<asp:Parameter Name="AccID" Type="Int32" />

</UpdateParameters>

<InsertParameters>

<asp:FormParameter Name="Routing" FormField="Label9" />

<asp:FormParameter Name="Hotel_Name" FormField="Textbox30" />

<asp:FormParameter Name="Check_in_date" FormField="Textbox50" />

<asp:FormParameter Name="Check_out_date" FormField="Textbox53" />

<asp:FormParameter Name="Included" FormField="Textbox85" /><asp:FormParameter Name="Room_Type" FormField="Textbox29" />

 

</InsertParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Travel BookingConnectionString8 %>"

DeleteCommand="DELETE FROM [Flights] WHERE [FlightID] = @FlightID" InsertCommand="INSERT INTO [Flights] ([Routing], [Date], [From Date], [To Date], [Dept Time], [Arrive Time], [Flight], [Class]) VALUES (@Routing, @Date, @From_Date, @To_Date, @Dept_Time, @Arrive_Time, @Flight, @Class)"

SelectCommand="SELECT [FlightID], [Routing], [Date], [From Date] AS From_Date, [To Date] AS To_Date, [Dept Time] AS Dept_Time, [Arrive Time] AS Arrive_Time, [Flight], [Class] FROM [Flights]"

UpdateCommand="UPDATE [Flights] SET [Routing] = @Routing, [Date] = @Date, [From Date] = @From_Date, [To Date] = @To_Date, [Dept Time] = @Dept_Time, [Arrive Time] = @Arrive_Time, [Flight] = @Flight, [Class] = @Class WHERE [FlightID] = @FlightID">

<DeleteParameters>

<asp:Parameter Name="FlightID" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="Routing" Type="String" />

<asp:Parameter Name="Date" Type="DateTime" />

<asp:Parameter Name="From_Date" Type="String" />

<asp:Parameter Name="To_Date" Type="String" />

<asp:Parameter Name="Dept_Time" Type="DateTime" />

<asp:Parameter Name="Arrive_Time" Type="DateTime" />

<asp:Parameter Name="Flight" Type="String" />

<asp:Parameter Name="Class" Type="String" />

<asp:Parameter Name="FlightID" Type="Int32" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="Routing" Type="String" />

<asp:Parameter Name="Date" Type="DateTime" />

<asp:Parameter Name="From_Date" Type="String" />

<asp:Parameter Name="To_Date" Type="String" />

<asp:Parameter Name="Dept_Time" Type="DateTime" />

<asp:Parameter Name="Arrive_Time" Type="DateTime" />

<asp:Parameter Name="Flight" Type="String" />

<asp:Parameter Name="Class" Type="String" />

</InsertParameters></asp:SqlDataSource>

 

 

<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:Travel BookingConnectionString4 %>"

DeleteCommand="DELETE FROM [Passenger] WHERE [PassengerID] = @PassengerID" InsertCommand="INSERT INTO [Passenger] ([Surname], [Name], [Initials], [Title], [Tel], [Fax], [FrequentFlyerNumber], [SeatingPreference], [Account Number], [OrderNo], [VehicleID], [AccomodationID], [FlightID], [Travel Consultant]) VALUES (@Surname, @Name, @Initials, @Title, @Tel, @Fax, @FrequentFlyerNumber, @SeatingPreference, @Account_Number, @OrderNo, @VehicleID, @AccomodationID, @FlightID, @Travel_Consultant)"

SelectCommand="SELECT [PassengerID], [Surname], [Name], [Initials], [Title], [Tel], [Fax], [FrequentFlyerNumber], [SeatingPreference], [Account Number] AS Account_Number, [OrderNo], [VehicleID], [AccomodationID], [FlightID], [Travel Consultant] AS Travel_Consultant FROM [Passenger]"

UpdateCommand="UPDATE [Passenger] SET [Surname] = @Surname, [Name] = @Name, [Initials] = @Initials, [Title] = @Title, [Tel] = @Tel, [Fax] = @Fax, [FrequentFlyerNumber] = @FrequentFlyerNumber, [SeatingPreference] = @SeatingPreference, [Account Number] = @Account_Number, [OrderNo] = @OrderNo, [VehicleID] = @VehicleID, [AccomodationID] = @AccomodationID, [FlightID] = @FlightID, [Travel Consultant] = @Travel_Consultant WHERE [PassengerID] = @PassengerID">

<DeleteParameters>

<asp:Parameter Name="PassengerID" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="Surname" Type="String" />

<asp:Parameter Name="Name" Type="String" />

<asp:Parameter Name="Initials" Type="String" />

<asp:Parameter Name="Title" Type="String" />

<asp:Parameter Name="Tel" Type="String" />

<asp:Parameter Name="Fax" Type="String" />

<asp:Parameter Name="FrequentFlyerNumber" Type="String" />

<asp:Parameter Name="SeatingPreference" Type="String" />

<asp:Parameter Name="Account_Number" Type="String" />

<asp:Parameter Name="OrderNo" Type="Int32" />

<asp:Parameter Name="VehicleID" Type="Int32" />

<asp:Parameter Name="AccomodationID" Type="Int32" />

<asp:Parameter Name="FlightID" Type="Int32" />

<asp:Parameter Name="Travel_Consultant" Type="String" />

<asp:Parameter Name="PassengerID" Type="Int32" />

</UpdateParameters>

<InsertParameters>

<asp:formParameter Name="Surname" formfield="Textbox21" />

<asp:formParameter Name="Name" formfield="Textbox22" />

<asp:formParameter Name="Initials" formfield="Textbox24" />

<asp:formParameter Name="Title" formfield="Textbox26" />

<asp:formParameter Name="Tel" formfield="Textbox27" />

<asp:formParameter Name="Fax" formfield="Textbox28" />

<asp:formParameter Name="FrequentFlyerNumber" formfield="Textbox29" />

<asp:formParameter Name="SeatingPreference" formfield="Textbox55" />

<asp:formParameter Name="Account_Number" formfield="Textbox18" />

<asp:formParameter Name="OrderNo" formfield="Label2" />

<asp:Parameter Name="VehicleID" Type="Int32" />

<asp:Parameter Name="AccomodationID" Type="Int32" />

<asp:Parameter Name="FlightID" Type="Int32" />

<asp:formParameter Name="Travel_Consultant" formfield="Textbox19" />

</InsertParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:Travel BookingConnectionString5 %>"

DeleteCommand="DELETE FROM [Vehicle] WHERE [VehicleID] = @VehicleID" InsertCommand="INSERT INTO [Vehicle] ([Company Name], [Group], [Pick Up Time], [Pick Up Date], [Drop Off Address], [Drop Off Time], [Drop Off Date], [Pick up Address]) VALUES (@Company_Name, @Group, @Pick_Up_Time, @Pick_Up_Date, @Drop_Off_Address, @Drop_Off_Time, @Drop_Off_Date, @Pick_up_Address)"

SelectCommand="SELECT [VehicleID], [Company Name] AS Company_Name, [Group], [Pick Up Time] AS Pick_Up_Time, [Pick Up Date] AS Pick_Up_Date, [Drop Off Address] AS Drop_Off_Address, [Drop Off Time] AS Drop_Off_Time, [Drop Off Date] AS Drop_Off_Date, [Pick up Address] AS Pick_up_Address FROM [Vehicle]"

UpdateCommand="UPDATE [Vehicle] SET [Company Name] = @Company_Name, [Group] = @Group, [Pick Up Time] = @Pick_Up_Time, [Pick Up Date] = @Pick_Up_Date, [Drop Off Address] = @Drop_Off_Address, [Drop Off Time] = @Drop_Off_Time, [Drop Off Date] = @Drop_Off_Date, [Pick up Address] = @Pick_up_Address WHERE [VehicleID] = @VehicleID">

<DeleteParameters>

<asp:Parameter Name="VehicleID" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="Company_Name" Type="String" />

<asp:Parameter Name="Group" Type="String" />

<asp:Parameter Name="Pick_Up_Time" Type="DateTime" />

<asp:Parameter Name="Pick_Up_Date" Type="String" />

<asp:Parameter Name="Drop_Off_Address" Type="String" />

<asp:Parameter Name="Drop_Off_Time" Type="DateTime" />

<asp:Parameter Name="Drop_Off_Date" Type="String" />

<asp:Parameter Name="Pick_up_Address" Type="String" />

<asp:Parameter Name="VehicleID" Type="Int32" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="Company_Name" Type="String" />

<asp:Parameter Name="Group" Type="String" />

<asp:Parameter Name="Pick_Up_Time" Type="DateTime" />

<asp:Parameter Name="Pick_Up_Date" Type="String" />

<asp:Parameter Name="Drop_Off_Address" Type="String" />

<asp:Parameter Name="Drop_Off_Time" Type="DateTime" />

<asp:Parameter Name="Drop_Off_Date" Type="String" />

<asp:Parameter Name="Pick_up_Address" Type="String" />

</InsertParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:Travel BookingConnectionString6 %>"

DeleteCommand="DELETE FROM [Order] WHERE [OrderNo] = @OrderNo" SelectCommand="SELECT * FROM [Order]" InsertCommand="INSERT INTO [Order] ([Date]) VALUES (@Date)" UpdateCommand="UPDATE [Order] SET [Date] = @Date WHERE [OrderNo] = @OrderNo">

<DeleteParameters>

<asp:Parameter Name="OrderNo" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="Date" Type="DateTime" />

<asp:Parameter Name="OrderNo" Type="Int32" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="Date" Type="DateTime" />

</InsertParameters>

</asp:SqlDataSource>Protected Sub Save_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Save.Click



SqlDataSource1.Insert()

SqlDataSource2.Insert()

SqlDataSource3.Insert()

SqlDataSource4.Insert()

 

 

 

End Sub

thanx in advance

View 7 Replies


ADVERTISEMENT

Unable To Insert Records In A Mssql Database With A Access Front End

Nov 18, 2006

I have a database that is in mssql and I'm using an odbc link to an access database where I want to add records to the mssql table. When I open the linked table in access it does not allow me to add a record. I have created a user account in mssql that has ownership to the database and I use this user in setting up the odbc link.

View 3 Replies View Related

Unable To Prepare The SSIS Bulk Insert For Data Insertion

Oct 24, 2007



Hi,

I am using SQL Server Destinations in my data flow tasks. I'm running this package in the server until i encountered this error:

OnError,,,LOAD AND UPDATE Dimension Tables,,,10/24/2007 1:22:23 PM,10/24/2007 1:22:23 PM,-1071636367,0x,Unable to prepare the SSIS bulk insert for data insertion.
OnError,,,Load Dimensions,,,10/24/2007 1:22:23 PM,10/24/2007 1:22:23 PM,-1071636367,0x,Unable to prepare the SSIS bulk insert for data insertion.
OnError,,,Discount Reason, ISIS Condition, ISIS Defect, ISIS Repair, ISIS Section, ISIS Symptom, Job Status, Parts, Purchase SubOrder Type, Service Contract, Service Reason, Service Type, TechServiceGrp, WarrantyType, Branch, Wastage Reason,,,10/24/2007 1:22:23 PM,10/24/2007 1:22:23 PM,-1073450974,0x,SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Dim_T_ISISDefect" (56280) failed with error code 0xC0202071. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.


What could be the reason for this? I don't usually have an error.

cherriesh

View 6 Replies View Related

SQL ServerDestination Error - Unable To Prepare The SSIS Bulk Insert For Data Insertion.

Jan 15, 2008



Having searched the forum, this one clearly has form... However beyond assisting those who have fallen at the first hurdle (i.e. forgetting/not knowing that they cannot execute the package remotely to the instance of SQL Server into which they are inserting), the issues raised by others have not been addressed. Thus I am bringing nothing new to the table here - just providing an executive summary of problems which others have run into, written about, but not received answers for.

First the complete error:
Description: Unable to prepare the SSIS bulk insert for data insertion. End Error Error: 2008-01-15 04:55:27.58 Code: 0xC004701A Source: <xxx> DTS.Pipeline Description: component "<xxx> failed the pre-execute phase and returned error code 0xC0202071. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 4:53:34 AM Finished: 5:00:00 AM Elapsed: 385.384 seconds. The package execution failed. The step failed.

Important points


It mostly works - It produces no error more than 9 times out of 10.

It fails on random dataflows - My package has several dataflows, (mostly) executing concurrently. Where the error occurs it does not do so on the same dataflow each time: on one run it'll fail on dataflow A whilst B,C,D and E succeed, then A-E will all succeed (and continue doing so for the next ten runs thereafter), and then the error recurs for dataflow D, with A,B,C and E all succeeding.
Hope someone has something interesting to say,


Tamim.

View 10 Replies View Related

SQL Server 2012 :: Unable To Load Data From Flat File To Table Using Bulk Insert Statement

Apr 3, 2015

I am unable to load data from flat file to sql table using bulk insert sql statement

My code:-

DECLARE @filePath VARCHAR(200)
DECLARE @sql VARCHAR(8000)
Declare @filename varchar(100)
set @filename='CCNVZ_150401054418'
SET @filePath = 'I:IncomingFiles'+@FileName+'.txt'

[Code] .....

View 1 Replies View Related

Unable To Retrive Data From MS SQL Database

Jun 6, 2005

I have a locally installed MS SQL server 2000. I am trying to retrieve the contents of the table onto a datagrid. But when I use the user name and password, It gives the following errorSystem.Data.SqlClient.SqlException: Login failed for user 'aroop'. Reason: Not associated with a trusted SQL Server connection.   string connectionString = "server=(local); uid=aroop; pwd=abcdef; database=mydb";   string commandString = "select * from mytable";   SqlDataAdapter dataAdapter = new SqlDataAdapter(commandString, connectionString);
   DataSet dataSet = new DataSet();   dataAdapter.Fill(dataSet);
   dgEmployees.DataSource = dataSet;   dgEmployees.DataBind();Can someone please let me know what to do about this?

View 1 Replies View Related

Unable To Insert Converted Date Into Date Column (Data Type)

Aug 24, 2015

PHP Code:

INSERT INTO [GPO].dbo.tblMetric  (KPI_ID, METRIC_ID, GOAL, REPORTING_MONTH, ACTUALS) 
SELECT 
    
      1 AS KPI_OWNER_ID
    , 23 AS METRIC_ID 
    , .75 AS GOAL 
    , CAST(Z.REPORTING_MONTH as DATE) AS REPORTING_MONTH
    , SUM(CAST(FTP_COUNT AS DECIMAL))/SUM(CAST(FULL_COUNT AS DECIMAL)) AS ACTUALS

[Code] ....

The insert column I am trying to get into is a date type. The original state of the field is YYYYMM varchar. How to get this into the table.

View 3 Replies View Related

T-SQL (SS2K8) :: Unable To Extract Data Based On Matching Info From A Local Database

Oct 2, 2014

I have a MySql Database i need to extract data from based on matching info in a local SQL Server database,

I will ultimately need to cycle through 20 of these MySql databases , but the query below is taking 1 minute and 20 plus seconds...Just for one..

Is there a simple tweak that would speed it up?

USE [CAS]
GO
DECLARE @PhoneDB varchar(max),
@SQL NVARCHAR(MAX);
set @PhoneDB = '[PHONEDB_PHI]';
set @SQL = 'SELECT

[Code]....

View 4 Replies View Related

SQL Express Database Table Data Insert Into Another Database

Apr 15, 2007

Hi,

I have two SQL Express database and I want to do two things. One is to transfer a table over to the other database. Two, move the files from one table in one database to another. Please let me know when you get a chance.

Thanks,

Kyle

View 8 Replies View Related

Insert Data Into Database

Feb 27, 2007

What is wrong with this code the dropdowlist mainlyusing System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Data.SqlClient;public partial class NewAccount : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {    }    protected void NaccountButton_Click(object sender, EventArgs e)    {        if (Page.IsValid)        {            //Define data objects            SqlConnection conn;            SqlCommand comm;            //read from web config            string connectionString = ConfigurationManager.ConnectionStrings["OneBank"].ConnectionString;            //Initialize connection             conn = new SqlConnection(connectionString);            //create command            comm =new SqlCommand(                "INSERT INTO Customer (FirstName, LastName, Street, City, State," +                 "Zip, Phone, Payee,AccountType)" +                 "VALUES(FirstName, LastName, Street, City," +                 "State, Zip, Phone, Payee,AccountType)", conn);            //add parameters            comm.Parameters.Add("@FirstName", System.Data.SqlDbType.NVarChar, 50);            comm.Parameters["@FirstName"].Value=Firstname.Text;            comm.Parameters.Add("@LastName", System.Data.SqlDbType.NVarChar, 50);            comm.Parameters["@LastName"].Value=lastname.Text;            comm.Parameters.Add("@Street", System.Data.SqlDbType.NVarChar, 50);            comm.Parameters["@Street"].Value=street.Text;            comm.Parameters.Add("@City", System.Data.SqlDbType.NVarChar, 50);            comm.Parameters["@City"].Value=city.Text;            comm.Parameters.Add("@State", System.Data.SqlDbType.NVarChar, 50);            comm.Parameters["@State"].Value=state.Text;            comm.Parameters.Add("@Phone", System.Data.SqlDbType.Int);            comm.Parameters["@Phone"].Value=phone.Text;           comm.Parameters.Add("@AccountType", System.Data.SqlDbType.NVarChar, 50);           comm.Parameters["AccountType"].Value = dropdownlist1.SelectedValue.ToString();            //Enclose database in try catc finally            try            {                //open connection                conn.Open();                //execute the command                 comm.ExecuteNonQuery();                //reload query                Response.Redirect("NewAccount.aspx");            }            catch            {                //Display error               Errormessage.Text=                    "Error submitting request!";            }            finally            {                conn.Close();            }        }    }}
 
This is the table where thisis going
customer                       -------------                     customerID pk generated automatically firtsname                            lastname                             street                                                               city                                                                       statezipphoneaccountType

View 3 Replies View Related

How To Insert Xml Data Into Database

Jul 21, 2005

I have a table changereport and network info.i  insert a record with date of insertion plus chagereport id.then I have a xml file
<ChangeReport> <Network-Info>  <Version> 2.0</Version>  <Highest-Ver> 2.0</Highest-Ver>  <Description> WinSock 2.0</Description>  <System-Status> Running</System-Status>  <Max> 2.0</Max>  <IP-address> 192.168.142.1</IP-address>  <Domain-Name> samin</Domain-Name>  <UDP-Max> 2.0</UDP-Max>  <Computer-Name> SAMIN</Computer-Name>  <User-Name> samin</User-Name> </Network-Info></ChangeReport>
I want's to insert a record in network info table where field name are nodes name data should be the one against those nodes in xml file .How can I do it I am using sql server
 

View 2 Replies View Related

Insert Data Into SQL Database

Feb 21, 2006

What have I done wrong with this script?I'm getting an error The ConnectionString property has not been initialized.



Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.

Exception Details: System.InvalidOperationException: The ConnectionString property has not been initialized.

Source Error:




Line 73: myCommand.Parameters.Add(New SqlParameter("@Activationcode", SqlDbType.nVarChar, 50))Line 74: myCommand.Parameters("@Activationcode").value = activecode.valueLine 75: myCommand.Connection.open()Line 76: tryLine 77: myCommand.ExecuteNonQuery()





Dim loConn as New SqlConnection(ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_HWB"))Dim myCommand as SqlCommandDim InsertCmd as StringinsertCmd = "insert into Login values (@Username, @Password, @email, @Activationcode);"myCommand = New SqlCommand(InsertCmd, loConn)myCommand.Parameters.Add(New SqlParameter("@Username", SqlDbType.nVarChar, 50))myCommand.Parameters("@Username").value = Username.valuemyCommand.Parameters.Add(New SqlParameter("@Password", SqlDbType.nVarChar, 50))myCommand.Parameters("@Password").value = Password.valuemyCommand.Parameters.Add(New SqlParameter("@email", SqlDbType.nVarChar, 50))myCommand.Parameters("@email").value = email.valuemyCommand.Parameters.Add(New SqlParameter("@Activationcode", SqlDbType.nVarChar, 50))myCommand.Parameters("@Activationcode").value = activecode.valuemyCommand.Connection.open()myCommand.ExecuteNonQuery()myCommand.Connection.Close()

View 1 Replies View Related

Can't Insert Data Into Sql Database

Apr 10, 2006

hi
It seems that my code can insert data into memory, but not into the database. What I mean is that after "insert data", I can "read data",
which I just insert. When I check the actual database table, it didn't
get updated.

I am using VS 2005 and table designer. Regarding to this problem, is
it related to any setting of setup of the database? I check the code,
and I have no idea how it occurs.


private static string connectionString = null;
private static SqlConnection connection = null;
private static string commandString = null;
private static SqlCommand command = null;
private static SqlDataReader reader = null;

static void Main(string[] args)
{
connectionString = ConfigurationManager
.ConnectionStrings["appDatabase.Properties.Settings.databaseConnection String"]
.ConnectionString;

connection = new SqlConnection(connectionString);

try
{
// Insert data
commandString = @"INSERT INTO userTable
(userID, permissionLevel, mobile, emailAddress, mailAddress, pager) VALUES(1, 2, '123', 'aa@a.com', 'oz', 'no')";
SqlCommand command = new SqlCommand(commandString, connection);
connection.Open();
command.ExecuteNonQuery();
connection.Close();

// Read data
commandString = @"select * from userTable";
command = new SqlCommand(commandString, connection);
connection.Open();
reader = command.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader["permissionLevel"].ToString());
}
connection.Close();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}

regards
figo2476

View 5 Replies View Related

How To Insert Data Into Database

Apr 8, 2008

how to insert data from asp page into sql database using visual basic?????

View 3 Replies View Related

Insert Data Values Into SQL Database

Sep 18, 2007

Ok what i am looking to do i cannot figure out.
 What i want to do is have a simple script that when a user logs onto the website (via windows auth) to get there username somehow llike with
Request.ServerVariables("LOGON_USER") 
that should display there username either "domain/name" or "username"
and then insert that into the UserLogs Table under my database with the date with the GETDATE() command..
 But when i do this i cannot get the page to auto submit the values.  Actually i cannot get anything to write to the DB unless i am doing it under the query builder.
Here is my Query that i was using.
INSERT INTO UserLogs([User], Date) VALUES (@UserName, GETDATE())
then in the Code of the page i have
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SubmitForm.aspx.vb" Inherits="Template_SubmitForm" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"><title>Untitled Page</title>
</head>
<body><% Dim name
name = Request.ServerVariables("LOGON_USER")%>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:REPCOMConnectionString %>"
InsertCommand="INSERT INTO UserLogs([User], Date) VALUES (@name, GETDATE())"
SelectCommand="SELECT [User], Date FROM UserLogs" CancelSelectOnNullParameter="False">
<InsertParameters>
<asp:SessionParameter DefaultValue="test1234" Name="name" SessionField="name" />
</InsertParameters>
</asp:SqlDataSource>
 </form>
</body>
</html>
 
So i know i am doing something wrong but what?
 
Thank You,
Corey

View 1 Replies View Related

How To Make This Insert Data Into Sql Database

Dec 26, 2007

Hallow
My code does not insert Data into Database, please can someone look on it and give a technical problem over here please
It does not generate any error please, when I CLICK THE BUTTON IT DOES NOT GENERATE ERROR, IT GIVE ME THE MESSAGE THAT ITEM ADDED, BUT WHEN I LOOK MY TABLE NOTHING ID INSIDE Sub Add_To_Cart(ByVal Src As Object, ByVal Args As EventArgs)
 Dim FVProductID As Label = FormView1.FindControl("ProductID")
Dim FVProductName As Label = FormView1.FindControl("ProductName")Dim FVProductPrice As Label = FormView1.FindControl("ProductPrice")
 Dim DBConnection As SqlConnection Dim DBCommand As SqlCommand
Dim sql As String
Dim SQLAddString As String
 DBConnection = New SqlConnection("Data Source=MANDARISQLEXPRESS;Initial Catalog=SHOES;Integrated Security=True")
DBConnection.Open()
If Not Session("OrderID") Is Nothing Then
 sql = "SELECT Count(*) FROM ShoppingCart " & _ "WHERE OrderID = '" & CType(Session("OrderID"), String) & "' " _
& "AND ProductID = '" & FVProductID.Text & "'"
 DBCommand = New SqlCommand(sql, DBConnection)
 
If DBCommand.ExecuteScalar() = 0 Then
 SQLAddString = "INSERT INTO ShoppingCart (OrderID, ProductID, OrderDate, ProductName, ProductPrice, ProductQnty) VALUES (" & _
"'" & CType(Session("OrderID"), String) & "', " & _"'" & FVProductID.Text & "', " & _
"'" & Today() & "', " & _"'" & FVProductName.Text & "', " & _
"'" & FVProductPrice.Text & "', 1)"DBCommand = New SqlCommand(SQLAddString, DBConnection)
DBCommand.ExecuteNonQuery()
End If
End If
DBConnection.Close()
 
Src.Text = "Item Added"Src.ForeColor = Color.FromName("#990000") Src.BackColor = Color.FromName("#E0E0E0")
Src.Font.Bold = True
 
End Sub

View 3 Replies View Related

How Do I Insert These Data Into Database Guys???

Jan 3, 2008

 
Hii Folks
This is my Table Order(OrderNo, CartID, TotalAmount, Name, City, Email, Zip, Date), Then I have my code which I need to insert data into database, but OrderNo is automatically inserted
this is my code, but when I run it it shows the error page, if I remove the direction to my error page, it does not show anything and I don't see any error, could any one check for it please
Imports System
Imports System.Data.SqlClientPartial Class Checkout
Inherits System.Web.UI.PageProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadAmountLabel.Text = Session("OrderTotal").ToString()
SessionLabel.Text = Session.SessionID.ToString()
End SubProtected Sub ContinueButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ContinueButton.Click
Dim shopp As New SqlDataSource()shopp.ConnectionString = ConfigurationManager.ConnectionStrings("SHOESConnectionString").ConnectionString
shopp.InsertCommandType = SqlDataSourceCommandType.Text
shopp.InsertCommand = "INSERT INTO Order(CartID, TotalAmount, Name, City, Email, Zip, Date) VALUES (@CartID, @TotalAmount, @Name, @City, @Email, @Zip, @Date)"shopp.InsertParameters.Add("CartID", SessionLabel.Text)
shopp.InsertParameters.Add("TotalAmount", AmountLabel.Text)shopp.InsertParameters.Add("Name", NameTextBox.Text)
shopp.InsertParameters.Add("City", CityTextBox.Text)shopp.InsertParameters.Add("Email", EmailTextBox.Text)
shopp.InsertParameters.Add("Zip", ZipTextBox.Text)shopp.InsertParameters.Add("Date", DateTime.Now()) Dim rowaffected As Integer = 0
Try
rowaffected = shopp.Insert()Catch ex As Exception Server.Transfer("ErrorPage.aspx")
End Try
shopp = Nothing
If rowaffected <> 1 ThenServer.Transfer("ErrorPage.aspx")
ElseServer.Transfer("success_shopping.aspx")
End IfEnd Sub
End Class

View 6 Replies View Related

How To Insert Only Unique Data In Database

Apr 21, 2008

hello,
i have two datasets. i want to insert all data from one dataset to other.
i am using this:DataSet old = new DataSet();
download dd = new download();old = dd.contactlist("select", "admin", "001");
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Project1ConnectionString"].ToString());
try
{string cmd = "select * from contact";
SqlDataAdapter danew = new SqlDataAdapter(cmd, conn);DataSet dsOld = new DataSet();DataSet dsNew = new DataSet();
dsOld = old.Copy();
danew.Fill(dsNew);
 DataTable dtOld = dsOld.Tables[0];DataTable dtNew = dsNew.Tables[0];
 
//int i;foreach (DataRow objRow in dtOld.Rows)
//for(int i=0; i<dtOld.Rows.Count; i++)
{DataRow row;
row = dtNew.NewRow();
 row["company"] = objRow["company"];
row["cust_no"] = objRow["cust-no"];row["sman"] = objRow["sman"];
row["first_name"] = objRow["first-name"];row["contact_title"] = objRow["contact-title"];
row["type"] = objRow["type"];row["contact_loc"] = objRow["contact-loc"];
row["cust_name"] = objRow["cust-name"];row["addr1"] = objRow["addr1"];
row["addr2"] = objRow["addr2"];row["city"] = objRow["city"];
row["state"] = objRow["state"];row["zip"] = objRow["zip"];
row["territory"] = objRow["territory"];row["phone"] = objRow["phone"];
row["fax"] = objRow["fax"];row["extension"] = objRow["extension"];
row["email"] = objRow["email"];row["rec_key"] = objRow["rec_key"];
 
dtNew.Rows.Add(row);
}DataSet nds = dsNew.GetChanges();SqlCommandBuilder bld = new SqlCommandBuilder(danew);
danew.Update(nds);
}
here rec_key is the primary key.
this code works fine but it will insert all data from one dataset to other each time i click a button but i wanted that if data with a rec_key already exists will not insert. only unique values of rec_key will be inserted.
 i am using this code for this:foreach(DataRow rr in dtNew.Rows)
{
if (rr["rec_key"] == objRow["rec_key"])
{
 Response.Write("same");
}
else
{
 dtNew.Rows.Add(row);
}
}
but this doesn't work.
please guide me how can i do this.
thanks

View 1 Replies View Related

How To Insert Excel Data Into SQL Database?

Dec 24, 2006

Hello to All,

I'm searching a way get Excel data into SQL database and tried this "insert" process that given me error. Already create a table call "original_purged" contain column fields. Can anyone give me some tips to show the problem?

INSERT Original_Purged

SELECT OP_ID,RBDI,Title,Address,City,State,Zip,Plus4,Walkseq,Crrt,Endorse,City_rural,Dpb,Dpbc,updatedate
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="C:Original_Purged.xls";User ID=Ryan;Password=dellonee1405;Extended properties=Excel 5.0')...[52117639]
==========================================================
Error occur.............

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. Authentication failed.
[OLE/DB provider returned message: Cannot start your application. The workgroup information file is missing or opened exclusively by another user.]
OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80040e4d: Authentication failed.].


thank you
ryan,


RV

View 5 Replies View Related

.exe To Insert Data In SQLServer Database

Jul 20, 2005

How can I make an .exe file that can insert data automatically in aSQLServer database, I can do it in C, but how can I connect to SQLServerand execute a query.All data that I have to insert are data that I can have from PCenvironment variables.Thanks--Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

View 2 Replies View Related

Insert Data In DataBase From Txt File

May 5, 2008



Hello.
My application reads one file with more or less than 80 000 rows(like 09905003101399800464520220080408710200070050000020 90604500012000 )
Based on the index of each character the row is splited in 8 columns and then i must verify that 5 of this columns are not allready in the database... if they are the row is a duplicate and will not be inserted.

Wich is the best way to do that?
To make 80000 cals to the database or to send the file as xml to the database and after that to parse it .......
or if you know any other way it would help me very much.

In this moment i m using the 80000 calls method and it takes ~20 hours.
Please advice.... any advice will be highly apreciated.
Thank you.

View 6 Replies View Related

I'm Not Able To Insert Data From A Form Into A Database Table

Feb 18, 2007

Hello.  As the subject heading says, I'm not able to insert data typed into the contact form on my page into a database table.  I'm using an SqlDataSource object.  Here's the code for this page:
 
<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><%@ Page Language="VB" Debug="True" Explicit="True" ContentType="text/html" ResponseEncoding="iso-8859-1" %><%@ Import Namespace="System.Data" %><%@ Import Namespace="System.Data.Odbc" %><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head><body><div align="center">  <asp:label ID="label1" runat="server" Font-Name="Arial" Font-Size="24" ForeColor="#00FF00" /></div><div align="center">  <asp:label ID="label2" runat="server" Font-Name="Verdana" Font-Size="18" ForeColor="#0000FF" /></div><form runat="server" id="new_form">  <table width="50%" border="1" align="center" id="form_table">    <tr>       <td nowrap="nowrap">         <asp:label Font-Bold="true" Font-Size="10" runat="server" Font-Name="CarlysHand" Text="First Name" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("FirstName") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="15" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="first" TabIndex="1" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="first" Type="String" ErrorMessage="Please enter your first name." Display="Dynamic" /> </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Middle Initial" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("MI") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="1" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="mi" TabIndex="2" /></td>    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Last Name" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("LastName") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="18" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="last" TabIndex="3" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="last" Type="String" ErrorMessage="Please enter your last name." Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Number & Street" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("NoAndStreet") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="40" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="no_and_street" TabIndex="4" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="no_and_street" Type="String" ErrorMessage="Please enter your number and street." Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Unit #" BackColor="#FFE1E1" ForeColor="#FF0000" />      </td>      <td><asp:textbox text='<%#Bind("Unit") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="6" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="unit" TabIndex="5" /></td>    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="City" BackColor="#FFE1E1" ForeColor="#FF0000" />      </td>      <td><asp:textbox text='<%#Bind("City") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="20" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="city" TabIndex="6" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="city" Type="String" ErrorMessage="Please enter your city." Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="State" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("State") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="2" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="state" TabIndex="7" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="state" ErrorMessage="Please enter your state." Type="String" Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Zip Code" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("ZipCode") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="5" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="zip" TabIndex="8" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="zip" ErrorMessage="Please enter your zip code." Type="Integer" Display="Dynamic" />   <asp:regularexpressionvalidator Display="Dynamic" runat="server" ValidationExpression="[0123456789]{5}" ControlToValidate="zip" ErrorMessage="Please enter a valid US Zip Code" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Phone #" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("PhoneNumber") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="10" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="phone" TabIndex="9" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="phone" ErrorMessage="Please enter your phone number." Type="Double" Display="Dynamic" />      <asp:rangevalidator runat="server" ControlToValidate="phone" MinimumValue="2002000000" MaximumValue="9999999999" Type="Double" ErrorMessage="Please enter a valid US Phone Number." Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Email" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("Email") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="40" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="email" TabIndex="10" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="email" ErrorMessage="Please enter your email address." Type="String" Display="Dynamic" />      <asp:regularexpressionvalidator runat="server" ControlToValidate="email" ErrorMessage="Please enter a valid email address." ValidationExpression=".*@.{2,}..{2,}" Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Username" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("Username") %>' BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="12" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="username" TabIndex="11" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="username" ErrorMessage="Please enter your username." Type="String" Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Password" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td> <asp:textbox text='<%#Bind("Password") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="12" TextMode="Password" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="password" TabIndex="12" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="password" ErrorMessage="Please enter your password." Type="String" Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Confirm Password" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="12" TextMode="Password" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="confirm" TabIndex="13" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="confirm" ErrorMessage="Please confirm your password." Type="String" Display="Dynamic" />      <asp:comparevalidator runat="server" ControlToValidate="confirm" ControlToCompare="password" Type="String" ErrorMessage="Please input matching passwords." Display="Dynamic" />    </tr>    <tr>       <td colspan="2" align="center" nowrap="nowrap"><asp:linkbutton BorderColor="#0000FF" BorderWidth="3" BorderStyle="Dotted" ToolTip="Click me!" Text="Submit" Font-Name="CarlysHand" Font-Size="15" Font-Bold="true" BackColor="#CCCCCC" ForeColor="#FF0000" runat="server" ID="submit" TabIndex="14" /></td>    </tr>  </table>   <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="driver={MySQL ODBC 3.51 Driver};server=mysql01.discountasp.net; data source=bkfwebdesi1_mysqlConn;database=MYSQLDB_316823;uid=bkfwebdesi1; password=bkf2065" ProviderName="System.Data.Odbc"   InsertCommand="INSERT INTO ContactInfo VALUES (?, ?, ?, ?, ?, ?, ?, ?,       ?, ?, ?, ?, ?)">     <InsertParameters>  <asp:Parameter Name="ContactID" Type="Int32" />  <asp:Parameter Name="FirstName" Type="String" />  <asp:Parameter Name="MI" Type="String" />  <asp:Parameter Name="LastName" Type="String" />  <asp:Parameter Name="NoAndStreet" Type="String" />  <asp:Parameter Name="Unit" Type="String" />  <asp:Parameter Name="City" Type="String" />  <asp:Parameter Name="State" Type="String" />  <asp:Parameter Name="ZipCode" Type="Int32" />  <asp:Parameter Name="PhoneNumber" Type="String" />  <asp:Parameter Name="Email" Type="String" />  <asp:Parameter Name="Username" Type="String" />  <asp:Parameter Name="Password" Type="String" /> </InsertParameters>  </asp:SqlDataSource></form></body></html>
 
Thanks in advance for your help in this matter!
 
Brian

View 1 Replies View Related

Insert Data To MsSQL Express Database?

Jan 4, 2008

Hello there,I'm to asp.net, so please be patient :DMy question is, how do I simply add some data to my database? - With vb.net code, not a grid view or something like that..I want to connect to my database, insert some data to a table.It shouldn't be that hard?- Hope someone will take the 5 minutes, and help me :)Regards Jeppe

View 16 Replies View Related

Insert,update,select Data From The Database?

Jan 31, 2008

Hi everyone..i m new to this field.. can anyone explain me with simple example onhow to insert,update,select data from the sqldatabase? i m using vwd 2005 express edition along with sql express edition. plz explain the simple example with code (C#) including how to pass connection strings etc.thank you.jack.  

View 6 Replies View Related

Insert Data From Office To Hosted Database

Apr 28, 2006

What is the best way to insert records into an SQL Server 2005 database that's being hosted with my website.  The data will originate from customer sites as transactions.  Do I connect to the hosted database using TCP/IP or do I create web pages that accept the data variables?  This is all new to me!
I need this to happen unattended and 24/7/365
Thanks
Tim

View 1 Replies View Related

Insert Data From 1 Database Table To Another Dbase

Apr 4, 2008

how to insert data from 1 database table to another database tables


pls help me out
i m very much thank ful to u

Yaman

View 5 Replies View Related

Insert Date / Time Data To Database

Jun 3, 2014

I am new to sql database programming. developing an application using C# and sql server 2005. i am having problems with date insertion to database. I use datatimepicker control to get date input. here is my code. in table i use datetime column type.

strSQL = "Insert Into TB1 (PPT_No,Reference_No,Application_Date,Receipt_No,Citizenship,Purpose_Visit,Entry_Type,Visa_Category,Airline,Vessel_No,Date_Arrival,
Date_Departs,Collected_Date,Remarks) Values('" +txtPPT_No.Text+ "'," +application_Date.Value+ ",'" +txtRecieptNo.Text+ "','" +cmbcitizenship.Text+ "','"
+txtpurpose.Text+ "','" +cmbentry.Text+ "','" +cmbcategory.Text+ "','" +cmbAirLine.Text+ "','" +txtvesel.Text+
"'," +arrivalDate.Value+ ",'" +departsDate.Value+ ",'" +txtrefference_No.Text+ "'," +collected_Date.Value+ ",'" +txtremarks.Text+ "'";

all date fields i used datetimepicker control. where i went wrong?.

Error : "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value."

View 4 Replies View Related

[Urgent]Insert Data To SQL Database Problem

Jan 2, 2007

hi all,
i created a register form for users to fill in. I have a problem when i submit new record to my database. It shows "Invalid cast from System.String to System.Byte[]. i don't know how to solve the problem.
i have created a database name User_Profile.It included Username(char),Password(char),Name(varchar),Department(varchar),Workphone(binary),mobilephone(binary),Email(varchar).
Any problem with the data type?
Please help.Thanks.

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim cm As OleDbCommand = New OleDbCommand
Dim ds As New DataSet
Dim conn As OleDbConnection = New OleDbConnection("Provider=SQLOLEDb;Username=;Password=;Name=;Department=;Workphone=;Mobilephone=;Email=;Trusted_Connection=yes;Initial Catalog=InstantMessenger;Data Source=(local)")

cm.Connection = conn
cm.CommandText = "INSERT INTO User_Profile(Username,Password,Name,Department,Workphone,Mobilephone,Email)VALUES(?,?,?,?,?,?,?)"
cm.CommandType = CommandType.Text
conn.Open()

cm.Parameters.Add(New OleDbParameter)
cm.Parameters.Item(0).Direction = ParameterDirection.Input
cm.Parameters.Item(0).DbType = DbType.String
cm.Parameters.Item(0).Size = 10
cm.Parameters.Item(0).Value = txtUsername.Text

cm.Parameters.Add(New OleDbParameter)
cm.Parameters.Item(1).Direction = ParameterDirection.Input
cm.Parameters.Item(1).DbType = DbType.String
cm.Parameters.Item(1).Size = 10
cm.Parameters.Item(1).Value = txtPassword.Text

cm.Parameters.Add(New OleDbParameter)
cm.Parameters.Item(2).Direction = ParameterDirection.Input
cm.Parameters.Item(2).DbType = DbType.String
cm.Parameters.Item(2).Size = 50
cm.Parameters.Item(2).Value = txtName.Text

cm.Parameters.Add(New OleDbParameter)
cm.Parameters.Item(3).Direction = ParameterDirection.Input
cm.Parameters.Item(3).DbType = DbType.String
cm.Parameters.Item(3).Size = 50
cm.Parameters.Item(3).Value = txtDepartment.Text

cm.Parameters.Add(New OleDbParameter)
cm.Parameters.Item(4).Direction = ParameterDirection.Input
cm.Parameters.Item(4).DbType = DbType.Binary
cm.Parameters.Item(4).Size = 10
cm.Parameters.Item(4).Value = txtWorkphone.Text

cm.Parameters.Add(New OleDbParameter)
cm.Parameters.Item(5).Direction = ParameterDirection.Input
cm.Parameters.Item(5).DbType = DbType.Binary
cm.Parameters.Item(5).Size = 10
cm.Parameters.Item(5).Value = txtMobilePhone.Text

cm.Parameters.Add(New OleDbParameter)
cm.Parameters.Item(6).Direction = ParameterDirection.Input
cm.Parameters.Item(6).DbType = DbType.String
cm.Parameters.Item(6).Size = 50
cm.Parameters.Item(6).Value = txtEmail.Text

Try
cm.ExecuteNonQuery()
MessageBox.Show("Data Recorded Successfully")
Catch ex As Exception
MessageBox.Show(ex.Message)

End Try

conn.Close()

End Sub

View 3 Replies View Related

Update/insert The Xml Data In Database Table

Oct 10, 2007

From: JAGADISH KUMAR GEDELA [jgedela@miraclesoft.com]
Sent: 10/10/2007 4:13:43 PM
To: jgedela@miraclesoft.com [jgedela@miraclesoft.com]
Subject: forum
Hi all,

I need to Insert the XML File data into SQL SERVER 2005 db(table).
For that I created the table with XML Native column (using typed xml)
*********************************create table command************
CREATE TABLE XmlCatalog (
ID INT PRIMARY KEY,
Document XML(CONTENT xyz))
***********************************
In order to Create the table with typed xml ,before that we have to create the xml schema which i
mentioned below
************************************create schema command********
CREATE XML SCHEMA COLLECTION xyz AS
'Place xml schema file ’
************************************
I created the xml schema file by using the xmlspy software.

--------------------------Insert command---------
INSERT into XmlCatalog VALUES
(1,'copy xml file ‘)
-------------------------------
I need to retrieve the xml data from the table
------------select query----------
SELECT Document.query (‘data (/X12//UserId)') AS USERID,
Document.query (‘data (/X12/X12_Q1/header/ISA//ISA_Authorization_Information_Qualifier)')
AS
ISA_Authorization_Information from XmlCatalog.
-----------------


I Need to update/insert/delete the xml data in the table

Can you please suggest the procedure to implement the above requirement(insert/update/delete)

View 5 Replies View Related

How Do I Insert Data From An Access Db To A Empty SQL Database

Jul 11, 2007

Hi,

I'm new to VS2005 (vb.net) and here my situation



I have form with a dataset1 (tbl1, tbl2, tbl3, tbl4) pulling data from a Access db. and showing it on the form1(databound)

I need to write what is on form1 to the empty dataset2 in SQL 2005 db

I have created a new DB in SQL 2005 with a Table SQL1 which has the same fields as on form1. Please can some one show me how do I do this. Please



Thanks in advance for your response.

-NM

View 3 Replies View Related

Using Trigger To Insert Data To Different Server Database

Sep 25, 2007

i have 2 server named A and B

in A server have database server and B have database server

in A have database named A1 with table TA1 and in B have database named B1 with table TB1

i want if i insert data into database A1 table TA1 in server A, database B1 table TB1 in server B will insert the same data to

how can do that with trigger or other ways

thx u

View 2 Replies View Related

Insert Random Data Into Database Tables

May 28, 2008



Hi all


I have blank tables and i want to fill tables with data but i have many tables and i need script or whatever automated this operation like loop

thanks in advance


View 5 Replies View Related

Insert, Delete, Update Data In Database

Mar 14, 2006

hi. i'm trying to create a c# application which would insert, update and delete data from a database. could anyone pls point me to the right direction in which i should take? thanks in advance.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved