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!!
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">
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]"
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">
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
I have a database that is in mssql and I'm using an odbc link to an access database where I want to add records to the mssql table. When I open the linked table in access it does not allow me to add a record. I have created a user account in mssql that has ownership to the database and I use this user in setting up the odbc link.
I am using SQL Server Destinations in my data flow tasks. I'm running this package in the server until i encountered this error:
OnError,,,LOAD AND UPDATE Dimension Tables,,,10/24/2007 1:22:23 PM,10/24/2007 1:22:23 PM,-1071636367,0x,Unable to prepare the SSIS bulk insert for data insertion. OnError,,,Load Dimensions,,,10/24/2007 1:22:23 PM,10/24/2007 1:22:23 PM,-1071636367,0x,Unable to prepare the SSIS bulk insert for data insertion. OnError,,,Discount Reason, ISIS Condition, ISIS Defect, ISIS Repair, ISIS Section, ISIS Symptom, Job Status, Parts, Purchase SubOrder Type, Service Contract, Service Reason, Service Type, TechServiceGrp, WarrantyType, Branch, Wastage Reason,,,10/24/2007 1:22:23 PM,10/24/2007 1:22:23 PM,-1073450974,0x,SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Dim_T_ISISDefect" (56280) failed with error code 0xC0202071. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
What could be the reason for this? I don't usually have an error.
Having searched the forum, this one clearly has form... However beyond assisting those who have fallen at the first hurdle (i.e. forgetting/not knowing that they cannot execute the package remotely to the instance of SQL Server into which they are inserting), the issues raised by others have not been addressed. Thus I am bringing nothing new to the table here - just providing an executive summary of problems which others have run into, written about, but not received answers for.
First the complete error: Description: Unable to prepare the SSIS bulk insert for data insertion. End Error Error: 2008-01-15 04:55:27.58 Code: 0xC004701A Source: <xxx> DTS.Pipeline Description: component "<xxx> failed the pre-execute phase and returned error code 0xC0202071. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 4:53:34 AM Finished: 5:00:00 AM Elapsed: 385.384 seconds. The package execution failed. The step failed.
Important points
It mostly works - It produces no error more than 9 times out of 10.
It fails on random dataflows - My package has several dataflows, (mostly) executing concurrently. Where the error occurs it does not do so on the same dataflow each time: on one run it'll fail on dataflow A whilst B,C,D and E succeed, then A-E will all succeed (and continue doing so for the next ten runs thereafter), and then the error recurs for dataflow D, with A,B,C and E all succeeding. Hope someone has something interesting to say,
I have a locally installed MS SQL server 2000. I am trying to retrieve the contents of the table onto a datagrid. But when I use the user name and password, It gives the following errorSystem.Data.SqlClient.SqlException: Login failed for user 'aroop'. Reason: Not associated with a trusted SQL Server connection. string connectionString = "server=(local); uid=aroop; pwd=abcdef; database=mydb"; string commandString = "select * from mytable"; SqlDataAdapter dataAdapter = new SqlDataAdapter(commandString, connectionString); DataSet dataSet = new DataSet(); dataAdapter.Fill(dataSet); dgEmployees.DataSource = dataSet; dgEmployees.DataBind();Can someone please let me know what to do about this?
INSERT INTO [GPO].dbo.tblMetric (KPI_ID, METRIC_ID, GOAL, REPORTING_MONTH, ACTUALS) SELECT
1 AS KPI_OWNER_ID , 23 AS METRIC_ID , .75 AS GOAL , CAST(Z.REPORTING_MONTH as DATE) AS REPORTING_MONTH , SUM(CAST(FTP_COUNT AS DECIMAL))/SUM(CAST(FULL_COUNT AS DECIMAL)) AS ACTUALS
[Code] ....
The insert column I am trying to get into is a date type. The original state of the field is YYYYMM varchar. How to get this into the table.
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.
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
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
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.
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.
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>
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()
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
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];
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
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?
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.].
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
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.
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:
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
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.
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
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.
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)")
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)
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.