I want to get (SELECT??) data from a db (SQL), edit the data (+1) and then update (UPDATE??) the table with the edited value. How do I get the value from the db and then edit it and then update the field in the db?? Does someone has an example so I get on the way??
Hi, I'm new in ASP 2.0. I need to incorporate edit and delete capability in GridView. Using the wizard, i've generated this code. When I delete a row, it gets deleted but update does not work. I've tried several ways. I got no error or exception. But row is not updated. I've checked database, and I think the update query is not executing at all. Please let me know, what I'm doing wrong? Here is the source code for reference. I'm using Visual Studio 2005 with SQL server 2005 Express Edition. Regards
I am very new to SQL Server 2005. I have created a package to load data from a flat delimited file to a database table. The initial load has worked. However, in the future, I will have flat files used to update the table. Some of the records will need to be inserted and some will need to update existing rows. I am trying to do this from SSIS. However, I am very lost as to how to do this.
For prototyping purposes, is there a tool that reads a database's schema and generates (simple) table editor that allows manual editing of data. It would be good if the tool somehow made it easy to add foreign key values to reference data e.g. gender, status, ...I can kind of do this using Management Studios "Edit Top 200 Rows", but I was wondering if there is a more user friendly tool out there.
I use the SQL Compact Edition 3.1 as database for a desktop application. Everything works fine, but is it possible to edit the data (e.g. tables and views) in the SQL Server Management Studio? I can make a connection to the SQL CE database, but I can only edit the objects of a table. The option 'Open Table' as in SQL Server (2005) is not avalible? Does anybody know if it posible to edit the data with the Managementstudio (express)?
Hi All !I open a table in Query Analyzer by right clicking on it andselecting 'Open' and when the data is displayed in the view pane Iwould like to be able to edit it. It seems however that tables markedas read only (as shown on the top bar e.g. SQL Query Analyzer - [OpenTable ServerName.DBName.dbo.TableName(read-only)] ) can not be editedwhereas the one that do not have that attribute infront of the name Ican edit. Is there a way I can change the read only attribute of atable so that I can edit data directly in the view pane?Please let me know if there is !Thanks a heap ! :)Harkirat
This is very similar to the post: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1901076&SiteID=1
I am trying to do this. Basically, if the field I am checking contains a space - not an empty string - I want to assign it an empty string so it will get converted to NULL when it hits the SQL destination. The space character from the source is causing the rows to fail I want to force a NULLin the database as a "workaround" from something I am working on.
I thought I had this set up correctly, but it is not working. I have the field in question as an input field set to ReadWrite
If Row.[COLNAME].ToString = " " Then Row.[COLNAME] = "" End If
I am getting the following error:
[Assign District Code [12469]] Error: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer) at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper90 wrapper, Int32 inputID, IDTSBuffer90 pDTSBuffer, IntPtr bufferWirePacket)
Hi, I think the title explains it all really. I cannot configure the SqlDataSource to add Insert, Update and Delete statements - not through the wizard anyway. The view combines two tables, each containing 3 columns. I have tried using different combinations of columns, and ended up selecting all of them (making sure the foreign key column of the first table was given a different alias to the primary key column of the second table) but I still cannot enable editing. Cheers, Patrick
I have several DTS packages that connect to various Oracle databases. An upgrade has recently been done to one of the databases from 7.3 to 8i. The other databases were always 8i. Last week, I could edit data transer tasks normally, this week, DTS hangs and I have to use task manager to kill the process. It worked fine last week. I can successfully run the packages, I just can't edit them. I have no trouble editing or running packages that connect to databases other than the one recently upgraded. I have tried both OLE DB and ODBC connections with the same results. Does anyone have any ideas on how to fix this?
SSIS seems to automatically set the metadata type and for "typed" sources like database and XML connections it seems to take whatever the source column datatype is. If you use a cast or convert in the your source SQL query, it will not change the datatype of the metadata. This becomes an issue when doing things like merge joins on data from different sources and the join columns are different types (e.g. a ZipCode in one system is a varchar and it is an int in another system). I've been working around the issue by editing the XML code and changing the datatype there. Is there any way to do this through the GUI?
I'm having a real hard time coming up with a solution to this problem. I created a custom gridview control from Dino Esposito's "Extending Gridview" article which autogenerates a checkbox column that allows for multiple record selection. Once a user checks a box, the entire row gets selected. I added a dropdown list on the top of the page that has only two options, "Yes" or "No". What I'm trying to do is update a boolean column called "contract" (I'm using the Pubs sample database) for all selected rows (via checkboxes checked) depending on whether the user selects "Yes" or "No" from the drop down menu. For example,1) the user selects "No" in the dropdown2) The user checks all rows in the checkbox column for which he wants the all the values"contract" field set to "No"3) The user then clicks on a button called "Submit" and all selected records get updated to "No" under the "contracts" column. The idea is to allow the user to change the boolean values from a field for multiple records. Hence, making individual cells editable is pointless. Anybody have an idea how to go about this?
Hello, i currently have a gridview that is populated with data from a SQLServer datasource. I have put an output mask in the select statement, so the date and time attributes are displayed in the format i prefer them to be in. SELECT PatientNo, ConsultantName, HospitalName, CONVERT (varchar, Date, 101), CONVERT (varchar, Time, 8) FROM [Appointment]; However when i click the 'edit' link for a record in the gridview, i am unable to edit the date/time attributes and when i click update to confirm any changes to the other attributes, the values in the date/time attributes are emptied. How can i solve this update problem. I'm guessing i need to configure my SQL UPDATE statement, but bit stuck how i do this. Please help! Thanks, James
I have a sql server 2005 database with Delphi 2006 in the front end and for querrying and reporting we use MS Access 2003 by connecting to this database via ODBC connection. I recently found out that the SQL Server 2005 data connected thus can be edited (updated) from MS Access. I do not want end users to modify/update the SQL Server 2005 data from MS Access while I also want them to have the ability to insert/update/delete rights using the appropriate application interface. For now, I am handling this by creating a user id that is not permitted to update, insert and delete and using the same account in the ODBC. Is there a way in SQL Server 2005 you can control insert/update/delete rights for all users that will be applicable only in the ODBC mode?
building some kind of ecommerce site. I want to allow the user to modify the image that he has stored for a product. The image is stored in a directory, in the table GAMME I only have the image name. When the user selects a new Image, I first delete the old image in the directory, then save the new image, but what I can't do is to update the table with the new image name, when I write sqldatasource1.update() I have an error "the dictionnary passed with old values is empty"(translated from frengh). the update statement in sqldatasource1 is: " UPDATE Gamme SET imagename = @imagename, imagesize = @imagesize WHERE (product_ID = @original_product_ID)"
on events sqldatasource1.updating I have written: e.Command.Parameters("@imagename").Value = (FileUpload1.FileName).ToString() e.Command.Parameters("@taillevignette").Value = FileUpload1.PostedFile.ContentLength e.Command.Parameters("@original_product_ID").Value = Session("Product_ID").ToString this is not written but the session("product_ID") is the good value the problem must come from the last lign, but I don't Understand the problem and how to solve it.
I would like to update about 4,000 records. I would only be updating one column for 4,000 rows in a table that has 50,000 rows. The update information is not the same for each row. I will be updating this from an excell file. Can somebody please tell me how to do this without messing the rest of the data in the table?
I rebuilt my databases using bcp,in order to change sort order and char set. That was OK,the data were re-inserted,but now i can only modify data by SQL Server Enterprise Manager.When a try to chage data by Visual Data Manager or VB application using ODBDC,it's accused that the database is not updatable,it's read only.But in the properties it's updatable.Anybody has a hint of what'sgoing on??
What is the best to update line_no in following code. As you can see 1 invoice can have multiple lines. I would like to assign sequential number to all lines in invoice.
CREATE TABLE #xx (invoicenumber INT, line_no int )
INSERT INTO #xx VALUES(1000,0) INSERT INTO #xx VALUES(1000,0) INSERT INTO #xx VALUES(1000,0) INSERT INTO #xx VALUES(1000,0) INSERT INTO #xx VALUES(2000,0) INSERT INTO #xx VALUES(2000,0) INSERT INTO #xx VALUES(2000,0) INSERT INTO #xx VALUES(2000,0)
SELECT * FROM #xx
result of select * from #xx should be: 10001 10002 10003 10004 20001 20002 20003 20004
What is the best to update line_no in following code. As you can see 1 invoice can have multiple lines.
CREATE TABLE #xx (invoicenumber INT, line_no int )
INSERT INTO #xx VALUES(1000,0) INSERT INTO #xx VALUES(1000,0) INSERT INTO #xx VALUES(1000,0) INSERT INTO #xx VALUES(1000,0) INSERT INTO #xx VALUES(2000,0) INSERT INTO #xx VALUES(2000,0) INSERT INTO #xx VALUES(2000,0) INSERT INTO #xx VALUES(2000,0)
SELECT * FROM #xx
result of select * from #xx should be: 1000 1 1000 1 1000 1 1000 1 2000 2 2000 2 2000 2 2000 2
I have posted on this problem before, and got some wonderful help, but the problems keep growing!
In my table, I have projects,activities, credit amount, debit amount, starting balance. Each project can have several activities associated with it. Each project has a starting balance. Each activity posts an expense to the starting balance of the project. If the project has enough money to handle the charges made by the activities, all the activity expenses can be "posted". Then I want to re-adjust the balance and check the second activity. If there is still enough money to handle the charge from the second activity, then the expenses can be posted and the balance adjusted again. In this checking, I am creating a field called status, and flagging if the activity can clear or not, and a new balance field. The data I have can fall into different examples, listed below.
First example:Only one activity for a project project: 122400 activity: 0000 Cr_Amt: 2145.00 Dr_Amt: 0 Balance: 1190.00
In the above case, as the balance is less than the Cr_Amt, I want to set the Cr_Amt = Balance, and the new balance = 0 and have done that as follows:
Update r set r.Post_Cr = r.Bal_2300, r.new_Status = 'Can Clear', r.new_Balance = 0 From Rev_Rec_Check r WHERE r.project IN (Select project from Rev_Rec_Check d group by d.Project having count(d.project) = 1)
That seems to work for me.
Second Example: More than one activity, with credits and debits project: 145587 activity: 0000 Cr_Amt: 0 Dr_Amt: 2500 Balance: 1452
So, in this case, I need to add the Dr_Amt to the Balance and create a new balance (3952), and then check that the Balance can cover the Cr_Amt
UPDATE t SET t.New_Balance=(t.Bal_2300 + b.postDrSum) - b.PostCRSum, t.New_Status=(CASE WHEN (t.Bal_2300 -b.PostCRSum) >0 THEN 'Can Clear' ELSE 'Still Check' END) FROM Rev_Rec_Check t CROSS APPLY (SELECT SUM(post_Cr) as postCrSum, SUM(post_Dr) as postDrSum FROM Rev_Rec_Check a WHERE (a.project =t.project) AND (a.activity<=t.activity)) b
This does seems to work, and gives me the correct status, and adjusts the new balance correctly, but I realize that doing that doesn't achieve what I want. Ideally, in this example - where there is more than one project/activity, this is what I would like to see: project: 145587 activity: 0000 Cr_Amt: 0 Dr_Amt: 2500 Balance: 1452 newBalance: 3952
I want the amount that gets posted (the Cr_Amt) to reflect what is left in the balance.
There could be cases where there are several activities for one project, so I want to be able to scroll through each activity and post what I can from what they have left in their balance.
I don't know how to approach this. Am I making it more complicated than it actually is? Have I made any sense in trying to explain it?
i'm a newbie in database and i need some ideas for the below mentioned problem.
i'm creating sql table from a txt file using DTS package, now once the table gets created, i need to multiple some revenue accounts with xyz number and expense accounts with abc number.
i'm thinking more towards the line of writing a store procedure but don't have any experience in it.
PLease guide me in the right direction, also if a good book could be refered for future; which will help me query language and this kind of issues, that will be GREAT!!
I have the following below. I have a page that has a text box. I want it to look in the database (SQL Server 2005) and display the number (Assessor_Score) in the box if it exist. If it does not exist I want the user to put a number in and have it insert a new record to the database. I also want the user to be able to change the number that does show up. The code below just inserts two identical records into the database. Also, how do I assign Assessor_Score a value from the textbox to use in the insert statement? Thanks
'Open Connection set conn = Server.CreateObject("ADODB.Connection") conn.open NCRLAP_Conn set rs = Server.CreateObject("ADODB.Recordset") set rs2 = Server.CreateObject("ADODB.Recordset")
''''''''''''''''''Get QRS Assessor's Score'''''''''''''''''' str = "SELECT AssessorScore.iAsmtID, AssessorScore.sSubScale_Short, AssessorScore.Assessor_Score FROM AssessorScore WHERE (((AssessorScore.sSubScale_Short)='" & sSubScale_Short & "') AND ((AssessorScore.iAsmtID)=" & iAsmtID & "))" set rs = conn.execute(str) If rs.EOF = True then 'This score is not currently in Assessor_Score 'Insert now
str = "INSERT INTO AssessorScore (iAsmtID,sSubScale_Short,Assessor_Score) " & _ "VALUES ('" & iAsmtID & "','" & sSubScale_Short & "','" & Assessor_Score & "')" response.Write(str) conn.execute(str) Else This score is currently in Assessor_Score Assessor_Score = rs("Assessor_Score") UPDATE now str = "Update AssessorScore SET AssessorScore.iAsmtID = " & iAsmtID & ", AssessorScore.sSubScale_Short = " & sSubScale_Short & ", AssessorScore.Assessor_Score = " & Assessor_Score & " WHERE (((AssessorScore.sSubScale_Short)=" & sSubScale_Short & ") AND ((AssessorScore.iAsmtID)=" & iAsmtID & "))" End If 'response.Write(str) set rs = nothing conn.execute(str) str = ""
Is it possible to somehow update data as it is copied from source to destination using SSIS.
Currently I extract data from Database A, load it into database B, then clean/update the data in database B and then load it into database C using DTS on 2000.
What I would like to do is extract data from database A, clean/update it, then load it straight into database C without having to load it into database B first.
I am unable to clean/update the source data in database A, as this would be the obvious thing to do.
hello guyshere is my problem:i am developing a asp.net web app in .net 2.0. i have some sensitive data in my database. which is encrypted using DES ( with some key which is only known by the top level authorities ). now there is an option of changing the secret key. on changing the key the sensitive data has to decrypted using the old key and then again encrypted using the new key. Now if the no of records increases i am afraid that it might take a longer time and the application might look as it got hanged. guys i have no clue on how to do this. if you guys have any idea on how to implement this please let me know. any help would be appreciatedVignesh
hello all, I ran into a problem using the "sql data source updating " method. i'm using a form view with about 20 parameters that are bind to controls in the form view and 5 other parameters that i'm setting the value to in the "sql data source updating" method. Every thing updates find execept for the last 5 parameters that i'm setting the values to in the "sql data source updating" method. My store procedure(sp) updates and insert mulitple tables. For some UNKOWN reason the tables that uses the parameteres in the "sql data source updating " are inserting multple records when only 1 record should be inserted. Have anyone have this problem?
I have a database which is used for the asp.net login control and i use the same database for my website work too. In this database there are asp.net created tables for login controls and the tables that i have created for the website. Now when i add a user to the website, data is added in the asp.net created tables (like aspnet_membership, aspnet_users). I want to add some of the data that is added to these tables into the tables that i have created. Is there a way i can do this?
Sorry if this is a dumb question but I am just learning ASP.NET. My database is on a server running SQL Server 2000 and I have used Dreamweaver to build sites. I am trying to convert to ASP.NET. The problem I am having is that data is not updating when I change it in a GridView, DataList, etc. I have tried including the user name an password in the connection string without success. What did I miss? connectionString="Data Source=<ServerName>;Initial Catalog=<DatabaseName>;Integrated Security=True;Uid=sa;Pwd=<Password>;" This is the string I use in Dreamweaver which works;Driver={SQL Server};Server=<ServerName>;Database=<DatabaseName>;Uid=sa;Pwd=<Password>;
Hello, I am a relatively new user to SQL so forgive me if the solution is not very dificult :) I have a SQL database that contains a products table that includes part numbers with part descriptions. I need to change all the part descriptions (over 6000 records) so I exported the table into Excel. All the changes have been done in Excel but i am having problems trying to re-import the new data into the existing table. Any info would be appreciated. Thanks
I am relatively new to SQL and am having trouble with an update. I know I cannot use a join update and have to use subquery. I am not sure of the syntax on how to do this. Below is basically what I want to do, but cannot figure out how to do it with a subquery. Any help would be appreciated.
update revisedapps set alternateapp = t.alternateapp from tempalternateapps t join revisedapps r on t.appname = r.softwarename