Insert Data Into Database

Feb 27, 2007

What is wrong with this code
the dropdowlist mainly

using 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                                                                      
state
zip
phone
accountType

View 3 Replies


ADVERTISEMENT

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

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

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 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

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 View Related

Problems Trying To Insert Data Into The Database Using Excel

Oct 31, 2007


Hi all,

I have encountered a problem. In the past i run a sql query to select all the data from the excel file and insert them into my SQL database. However recently i encountered an error when i run the query.

Msg 7399, Level 16, State 1, Line 4
The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "excel_ls" reported an error. The provider did not give any information about the error.
Msg 7303, Level 16, State 1, Line 4
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "excel_ls".

How i solve this error. Any ideas?


Thanks

View 1 Replies View Related

Insert Data One Database To Other Database

May 7, 2007

hi

i am using this queries is

Insert into excelb.B.dbo.Emp(Employee_Name,Emp_addr) Values (@Employee_Name,@Emp_Addr) select * from excelb.A.dbo.Emp



excelb - server name

now my problem is a server to another server insert the data that not acces the data and i am using different password the servers- but same pasword are insert the data

plz help me



bye

elango

View 4 Replies View Related

Insert Unicode Data Into The Database With Typed DataSet

Dec 11, 2006

Hi all,I am using a Strongly Typed DataSet (ASP.NET 2.0) to insert new data into a SQL Server 2000 database, types of some fields in db are nvarchar. All thing work fine except I can not insert unicode data(Vietnamese language) into db.I can't find where to put prefix N. Please help me!!!   

View 1 Replies View Related

Database Insert Question - Best Practices For Empty Data

Apr 17, 2007

I am making a form that takes input for 1 to 5 students using VWD.  With the help of previous posts I have been able to make the database insert query work properly.  In my form I have a radio list that has the user select if they are entering information for 1, 2, 3,4, or 5 children.  Depending on how many children are selected on the radio list, I am displaying the proper number of textboxes and validating the data using the handy RequiredFieldValidator.  Now I am at the point where I want to perform the instert to the database depending on the selected number of children in the family.  What is the general rule for best  practices. Please keep in mind that it is my understanding that ALL fileds in a SQL insert statment must have data. Should I ...1) create alternative SQL statements depending on the textboxes displayed OR2) is it more common to insert a standard string or integer, depending on the datatype, into the unused textboxes to populate the unused fields? Sincerely,Mike 

View 2 Replies View Related

Using Stored Procedures To Insert And Pull Data From Database

Mar 21, 2008

I have my database: "RequestTrack"
My table (with its columns): "Request"RequestKey (automatically generated)..and the Primary KeyEntryDate  (datetime)Summary (nvarchar)RequestStatusCodeKey (bigint)EntryUserID   (nvarchar)EntryUserEmail (nvarchar)I am wanting to create a basic web form where my user interface has 3 text boxes and a Submit button:
txtUserID.TexttxtEmailAddress.TexttxtRequestSummary.Text
**After I hit the submit button the information will then be inserted into the database. Also the RequestStatusCodeKey will be MANUALLY typed in so that will not require the user to add that. Please please please help ! I've been searching online for days and looking at various websites and still havent found anything. I've found somethings but they went into too much depth with too much information. I am just wanting to stay basic but w/o using SQLDataSource Controls. I would like to be able to store a lot of data. Thanks for your help!!!

View 4 Replies View Related

Insert Data To Database Foxpro Using Open Query

Feb 24, 2014

Insert data to database foxpro using open query. I already create connection like below

@server = 'EXIMBIL_LINK',
@provider = 'MSDASQL',
@srvproduct = '',
@provstr = 'Driver={Microsoft Visual FoxPro Driver}; UID=;SourceDB=D: raining_testdata;SourceType=DBF ;Exclusive=No;BackgroundFetch=Yes'

when i try to show table van with command :

select * from openquery(EXIMBIL_LINK,'select * from van')

It show query running well but when i try to insert new row to table van with command :

INSERT into OpenQuery(EXIMBIL_LINK, 'SELECT c_user_id,c_user_name,full_name from van')
VALUES('1000007668','IDMTEST2','IDMTEST2')

throws error like this : Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done

View 1 Replies View Related







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