DB Engine :: Application That Insert Some Data In Database
Jun 15, 2015
What are the optimal values for this parameters? How it depends from queries characteristics?I create an application that insert some data in database. It'll work on different servers with different load and performance. I want to prevent timeout exceptions.
View 4 Replies
ADVERTISEMENT
Oct 5, 2015
Our application team make design changes of the database in their development server and asks me to restore the bak file from the development server into the production server with replace command. The database in the production server is connected to the application server and so when I try to restore the database error message comes that the database is in use.
So first I find out the sessions with the logins who is the user in the database with sys.dm_exec_sessions joined with sys.dm_exec_requests and then kill the sessions. And after that it is possible to restore. But many times when I kill the session and try to restore in between new sessions comes into effect which are generated from the web server and many times I have to resubmit the query in the dmv's and find the sessions and kill it again and again before restore can be done. Is there any correct method to restore an active database which is being accessed by the application from a web server with out stopping the web server?
View 6 Replies
View Related
Oct 27, 2015
I want to create one bacpac file but it does fails, Need I delete all the descriptions before to begin? How odd! I don't understand why can we choose some scripting options such as we did on 'Generate Scripts' task..I get errors such as: dbo.table.field.Ms_Description is not supported when used as part of a data package
View 2 Replies
View Related
Jul 9, 2015
I have an Excel file with .csv extension . it has on sheet with name Sheet1.
Now, I'm trying to insert this Excel data into one #temp table. I tried with syntax:
----------------
Exec sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
Exec sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 1;
[Code] ...
But, I'm getting error:
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. The provider did not give any information about the error.
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
If I'm executing for .xls file this statement is working finr and rows are inserted into #temp table. How to take excel file of .csv extension??
View 3 Replies
View Related
May 20, 2015
I am working on a package to insert and update contacts from a database into an application. To insert into application I am using script component.
So my question is can I do both insert and update script seperately in two different script components of same package.
My package looks something like this.
Can we push new inserts into one script component and updates to other script component?
Does both the script components execute at the same time?Will there be any conflicts between insert and update in the application?
View 7 Replies
View Related
Jul 31, 2015
I get the below error on the event log of my application server which uses SQL database.
Details: RuleId:a811dcbc-4c5b-d9de-592b-f01e17fc0e9a. HealthServiceId:a5f70248-b545-4d35-7c84-e7aa87610ee4. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Alert_BaseManagedEntity". The conflict occurred in database "OperationsManager",
table "dbo.BaseManagedEntity", column 'BaseManagedEntityId'.
The statement has been terminated.RuleId:a811dcbc-4c5b-d9de-592b-f01e17fc0e9a. HealthServiceId:a5f70248-b545-4d35-7c84-e7aa87610ee4. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Alert_BaseManagedEntity". The conflict occurred in database "OperationsManager", table "dbo.BaseManagedEntity", column 'BaseManagedEntityId'.The statement has been terminated..
Details: RuleId:a811dcbc-4c5b-d9de-592b-f01e17fc0e9a. HealthServiceId:a5f70248-b545-4d35-7c84-e7aa87610ee4. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Alert_BaseManagedEntity". The conflict occurred in database "OperationsManager", table "dbo. BaseManaged Entity", column 'BaseManagedEntityId'.The statement has been terminated..
View 5 Replies
View Related
Jun 30, 2015
The application server gets below error while the job is being run intermittently:
An error occurred while performing connection management
com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:319)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.prepareStatement(SQLServerConnection.java:1839)
[Code] ....
There is no error reported in SQL logs.
View 6 Replies
View Related
Sep 17, 2015
SQL Server 2008 R2: How security log is much secure than application log?
View 3 Replies
View Related
Sep 14, 2005
I'd like to build a simple search engine against Sql Server. Does .NET Framework provide some class to help in this task? From what I've heard there is an interface which implements it..
View 1 Replies
View Related
Jun 12, 2015
We have an issue where servers goes slow from morning 2 AM EST to 10 AM EST.
Using SP_WhoIsActive we somehow found that there is netbackup from Symantec which runs during that time phrase.
As per Symantec team there backup should get over by 5 AM EST, per their testing for almost 100 Dbs on the server( not big in size , all of them in total would be 60 GB).
Using SP_whoisactive we only see, start time of that virtual backup occurring on tape, for one database at time.
So is there a way we actually determine when does the above backup kicks and stops?Also, could SQL server be the problem in making these backups run slow or there is something else i need to monitor?
View 6 Replies
View Related
Jul 23, 2005
Hi there,I sincerely hope that someone out there can help. I have twoinstances of the SQL 2000 Desktop Engine running. One is on my localmachine for development and the other is on another machine on ournetwork which is the production environment. I have built an Access2003 front end application which connects to this database. Thisworks fine locally, as you would expect. I successfully installed thedatabase on the production machine and am able to connect to it viaAccess 2003 (using the Data Link Properties window) and from thirdparty database manager software (similar to Enterprise Manager). I amnot able to to connect to the database via my application.I am using the "sa" account with a strong password. This is myconnection string:strConnection = "Provider=sqloledb;DataSource=server02;UserId=sa;Password=strong;Initial Catalog=Test"The error I'm getting is:"Connection cannot be used to perform this operation. It is eitherclosed or invalid in this context."The connection string is the only thing that changes in my code when Iswitch from my local to my production database. Is there some reasonthat I can't use the "sa" account in this fashion that I'm not awareof? I'd rather not use integrated security for simplicity's sake asthis is a small, internal application. Also, I would have thoughtthat if that was the issue, I couldn't use "sa" at all, even locally.I'm going to post to the Access group as well but thought someone heremight have some advice to offer as well.Thanks,Barb
View 2 Replies
View Related
Dec 10, 2005
4 Layered Web Application for Inserting data into a database using sql server as the back end and a web form as the front end using C# .
Can someone provide with code as I am new to this architecture and framework.
Better send email.
Thanks In Advance,
A New Bie
View 1 Replies
View Related
Feb 18, 2006
Hi,
I am using VS2005 C# + sql server 2005 Express edition.
I need to using a database that uses my own defined data types to define its tables columns.
I already have designed a Database projact and create the new UDT as follows:
Create a new Database project in the Visual C# language nodes.
Add a reference to the SQL Server 2005 database that will contain the UDT.
Add a User-Defined Type class.
Write code to implement the UDT.
Select Deploy from the Build menu.
Now I need to ask some quistions:
1- When I try to add a new query to a table that contains my new data type in its columns,if I try to exexute the query the next message appears:
'Execution of user code in the .Net framework is disabled. Enable "clr enabled" configuration option'.
How can I doing that??
2- I need to use that database - which has the new data type - in a traditional ' Visual C# Windows Application' instead of 'Database', but:
when I try to add a new Data Source that contains the tables that have the new data types in its definitions, the next message appears:
'<AyaDatabase.dbo.MyNewUDTTable>
User-defined types(UDTs)are not supported in the Dataset Designer.'
So, how can I resolve that problem??
please help me.
Thanks in advance for any help.
Aya.
View 4 Replies
View Related
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
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
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
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
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
Apr 8, 2008
how to insert data from asp page into sql database using visual basic?????
View 3 Replies
View Related
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
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
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
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">
<br />
<br />
<asp:Button id="Button5" Text="Previous step" OnClick="PrevStep" runat="server"/>
<asp:Button ID="Save" runat="server" Text="Save" />
<input id="Button3" hidefocus="hidefocus" onclick="printpage(this)" type="button" value="Print" />
<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
View Related
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
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
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
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
Jul 31, 2015
I have a Bulk insert that doesn't load but doesn't error,
SET @SQL= 'BULK INSERT dbo.LexisNexis_import_BANKRUPTCY FROM ''' + @ImportFile + ''' WITH (FIRSTROW = 2, FORMATFILE = ''' + @FormatFilePath + ''' )'
EXEC(@SQL)
All columns in the csv are double quoted so I stip them out in a format file.There is data in the source file. Why this Isn't working?
View 4 Replies
View Related
Sep 9, 2015
I have a full backup scheduled at 12.00AM ET and have a batch import on 11.55PM(5 min before full backup) which takes 30min to complete .Will the backup cover the data which is being imported?
View 2 Replies
View Related
Mar 22, 2001
Does anyone have experience of geting SQL server to accept > 100 inserts per second?
We use a stored procedure to insert data and this has increased throughput from 30/sec with ODBC to 100-110 /sec but we desperately need to write to the DB faster than this!!
There doesnt seem to be any I/O backlog so i am assuming this "ceiling" is due to network overhead. (BCP can insert 3-4000 rows quite happily)
Is there any way to batch up these inserts or process them differently in order to improve throughput?
Much appreciated,
Damon
View 3 Replies
View Related
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
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
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