hai..i cannot solve this sproblem...i need to update my databse after i edited the textfield.then system will return me 'UPDATE SUCCESS'(because i return value UPDATE SUCCESS).this seem like nothing wrong.but when i check the database,data did not update!!have anybody know that?
thanks!!my coding as below,
#Region "Edit student Then save"
Public Function editstudent(ByVal sIC As String, ByVal school As String, ByVal phone As String, ByVal pic As String, ByVal pwd As String, ByVal sname As String, ByVal gender As String, ByVal add As String, ByVal standard As String, ByVal osic As String) As String
' Create Instance of Connection and Command Object
Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim command As String
Dim mycommand As SqlCommand
command = "Update student_info set sic =@sic, Spassword =@pwd," & _
"sname =@sname, sphone=@phone,saddress=@add, sstandard=@standard,sschool=@school ,Sparent_IC=@pic ,sGender=@gender Where sic =@osic"
mycommand = New SqlCommand(command, myConnection)
mycommand.CommandType = CommandType.Text
'' Add Parameters to Command
Dim parameterIC As SqlParameter = New SqlParameter("@sic", SqlDbType.VarChar, 12)
parameterIC .Value = sIC
mycommand.Parameters.Add(parameterIC )
Dim parameteroIC As SqlParameter = New SqlParameter("@osic", SqlDbType.VarChar, 12)
parameteroIC .Value = osic
mycommand.Parameters.Add(parameteroIC )
Dim parameterpwd As SqlParameter = New SqlParameter("@pwd", SqlDbType.VarChar, 50)
parameterpwd .Value = pwd
mycommand.Parameters.Add(parameterpwd )
Dim parametername As SqlParameter = New SqlParameter("@sname", SqlDbType.VarChar, 100)
parametername .Value = sname
mycommand.Parameters.Add(parametername )
Dim parameteradd As SqlParameter = New SqlParameter("@add", SqlDbType.VarChar, 100)
parameteradd .Value = add
mycommand.Parameters.Add(parameteradd )
Dim parameterphone As SqlParameter = New SqlParameter("@phone", SqlDbType.VarChar, 12)
parameterphone.Value = phone
mycommand.Parameters.Add(parameterphone)
Dim parameterstandard As SqlParameter = New SqlParameter("@standard", SqlDbType.VarChar, 50)
parameterstandard.Value = standard
mycommand.Parameters.Add(parameterstandard)
Dim parametersschool As SqlParameter = New SqlParameter("@school", SqlDbType.VarChar, 100)
parametersschool.Value = school
mycommand.Parameters.Add(parametersschool)
Dim parameterpic As SqlParameter = New SqlParameter("@pic", SqlDbType.VarChar, 12)
parameterpic.Value = pic
mycommand.Parameters.Add(parameterpic)
Dim parametergender As SqlParameter = New SqlParameter("@gender", SqlDbType.VarChar, 1)
parametergender.Value = gender
mycommand.Parameters.Add(parametergender)
Try
hi need help how to send an email from database mail on row update from stored PROCEDURE multi update but i need to send a personal email evry employee get an email on row update like send one after one email
i use FUNCTION i get on this forum to use split from multi update
how to loop for evry update send an single eamil to evry employee ID send one email
Hello,I am trying to update records in my database from excel data using vbaeditor within excel.In order to launch a query, I use SQL langage in ADO as follwing:------------------------------------------------------------Dim adoConn As ADODB.ConnectionDim adoRs As ADODB.RecordsetDim sConn As StringDim sSql As StringDim sOutput As StringsConn = "DSN=MS Access Database;" & _"DBQ=MyDatabasePath;" & _"DefaultDir=MyPathDirectory;" & _"DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;" &_"PWD=xxxxxx;UID=admin;"ID, A, B C.. are my table fieldssSql = "SELECT ID, `A`, B, `C being a date`, D, E, `F`, `H`, I, J,`K`, L" & _" FROM MyTblName" & _" WHERE (`A`='MyA')" & _" AND (`C`>{ts '" & Format(Date, "yyyy-mm-dd hh:mm:ss") & "'})"& _" ORDER BY `C` DESC"Set adoConn = New ADODB.ConnectionadoConn.Open sConnSet adoRs = New ADODB.RecordsetadoRs.Open Source:=sSql, _ActiveConnection:=adoConnadoRs.MoveFirstSheets("Sheet1").Range("a2").CopyFromRecordset adoRsSet adoRs = NothingSet adoConn = Nothing---------------------------------------------------------------Does Anyone know How I can use the UPDATE, DELETE INSERT SQL statementsin this environement? Copying SQL statements from access does not workas I would have to reference Access Object in my project which I do notwant if I can avoid. Ideally I would like to use only ADO system andSQL approach.Thank you very muchNono
I want to retrieve the last update time of database. Whenever any update or delete or insert happend to my database i want to store and retrieve that time.
I know one way is that i have to make a table that will store the datetime field and system trigger / trigger that can update this field record whenever any update insert or deletion occur in database.
But i don't know exactly how to do the coding for this?
We have a SQL database that uses Active Directory with Windows Authentication. Can users that are members of the Active Directory group that has read/write access to the SQL database create ODBC connections to access the database directly and update the data? They dont have individual logins on the server. They are only members of the Active Directory group that has a login?
I had to to relocate the database log file and I issued an Alter database command but by mistake I put a space in the file name as below. The space is at the beginning file name. Now I am unable get the database loaded to SQL Server. The database has 2 replications configured, so deleting and re-attaching the database means the replication needs to be re-configured. Is there an alternative way to issue a command to update the database FILENAME ? Not sure if this can be edited in master database (sys files).
ALTER DATABASE [User_DB] MODIFY FILE (NAME = User_DB_log, FILENAME = 'I:SQLLogs User_DB_log.ldf') GO
I actually work in an organisation and we have to find a solution about the data consistancy in the database. our partners use to send details to the organisation and inserted directly in the database, so we want to create a new database as a buffer database to insert informations from the partners then make an update to the main database. is there a better solution instead of that?
I have an original database that I want to copy once to another database. Then I want to update the data weekly with the data of the original database. I don€™t change any tables or columns in that part of the database. Just some tables more in the €˜new€™ database (than the tables from the original database) with some references to the tables that have to be updated weekly. How can I do this? (if you know what I mean... it's a sort of a datawarehouse where different sources come together.. that part that represents the original database is just a part of the datawarehouse. That part is exactly the same structure as the original database.)
Hi guys, may I know is it possible to create an update trigger like this ? Assuming there are two database, database A and database B and both are having same tables called 'Payments' table. I would like to update the Payments records on database A automatically after Payments records on database B had been updated. I can't use replication because both tables might having different records and some records are the same. Hope can get any assistance here, thank you.
I am using two database server. Both are sql server.Â
My task is :I want to insert data from server 1 table to server 2 table and update same when modified the existing data from server 1. is it possible to do the integration in single package.
I know to do insert and update seperately by ssis but need to do same with single task.Â
I'm new to ASP.NET (I normally work with Windows Forms) and have installed the Club Website Starter Kit. I created an Administrators role and a user called "admin". When I run the project locally, everything works as it should - I can log in as admin and I can create new users. I then copied the site to localhost (C:Inetpubwwwroot), but when I run the site from localhost, I can't log in (as admin or any other user); instead I get a message that says, "Your login attempt was not successful. Please try again." Also, I can't create a new user. When I try, I get the following error: Server Error in '/' Application.
Failed to update database "C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF" because the database is read-only. 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.Data.SqlClient.SqlException: Failed to update database "C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF" because the database is read-only.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42 I figure there must be a simple(?) explanation and solution for this problem, and ideally, some sort of step-by-step procedure that new users to ASP.NET can follow to configure a site - such as one of the starter kits - to work correctly. I can honestly say that trying to get this working has been an extremely frustrating experience. If someone could help me out, I would really appreciate it. I've been working on this for two days and feeling I have hit the wall. Thanks in advance.
Hi there,I am getting a real problem with ASP.NET 2.0, all i am trying to do is run a recovert password (using the login controls) and i got the following error.Does anybody know how to fix this? I have tried the SSEUTIL answer here and it didn't work. http://forums.asp.net/909168/ShowPost.aspxI also ensured that Network Services user has READ/WRITE/EXECUTE premissions on the directory below and that each file isn't read only and also that it inherits ACL from the directory which it seems to do..Bit of strange one this, it isn't created (and i am not using) a beta version of VS 2005 Pro... but a full retail version.The PC is the local PC with IIS 5.1 and VS installed... it is the one i am using for developing.. I don't need to copy my files to the IIS directory below as that is where i have created it and open it in VS 2005 from there..I did read that if you use IIS 5.1 then the user should be ASPNET ... but i don't seem to have that use but a Network Services user...Any help or guidance would be really appreciated... i have come to a stop stage and can't get any further..Thanksian Server Error in '/igdotcom' Application.
Failed to update database "C:INETPUBWWWROOTIGDOTCOMAPP_DATAASPNETDB.MDF" because the database is read-only. 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.Data.SqlClient.SqlException: Failed to update database "C:INETPUBWWWROOTIGDOTCOMAPP_DATAASPNETDB.MDF" because the database is read-only.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
hi i am currently testing my website on IIS7, and first error is that: Server Error in '/' Application.
Failed to update database "C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF" because the database is read-only. 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.Data.SqlClient.SqlException: Failed to update database "C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF" because the database is read-only.Source Error:
Line 109: Line 110: conn.Open(); Line 111: SqlDataReader reader = command.ExecuteReader(); Line 112: reader.Close(); Line 113: command.Connection.Close(); i cheked on aspnet_Data folder to see if is read-only AND IT IS, but if i change it, the read-only property is setting up again. why? thanks in advance
I have made sure that the permissions on the DB are set (in Windows) so that all users can modify. The user that is logging in to the DB has status set to DBOWNER.
I have seen others experience the same problem - with ASP.net sites, not Windows Forms sites (thus most of their solutions dont apply to me)
Any ideas on what is wrong and how I can get this to work?
I am trying to update a value in the aspnet_Users table using a gridview. I'm currently using the vw_aspnet_Users view to select which columns want to display. I have ensured the primary key exists and have it selected as a column to display (although it will serve no purpose). Unfortunately when I click on the advanced tab, it does not let me tick either boxes as they are both greyed out. I have followed "solutions" to this problem in other posts but as I definitely have the primary key source present AND selected, I dont see what the problem is. The only thing I have noticed is that in the "Configure the select statement" window, you are unable to see the aspnet_Users table in the dropdownlist (only the view is present). Non of the views that I choose allow me to update, however, when I choose one of my own tables that I have made (and these appear in the dropdownlist) the tickboxes become available. Is there an underlying problem with editing SQL sources using views? I need a view as I need to display information found in aspnet_Users and aspnet_Membership The following error is what is displayed after I click 'Update' Updating is not supported by data source 'SqlDataSource1' unless UpdateCommand is specified Thanks!
hi , I TRY TO UPDATE THE DATA IN THE DATAGRID, IT THROWS THE ERROR LIKE Specified cast is not valid. BELOW I ATTACHED, PLS GUIDE IS protected void updategrid_UpdateCommand(object source, DataGridCommandEventArgs e) { cmd.CommandText = "Update EMp_master set Empname=@Empname ,pwd=@pwd, emailId=@EmailId, Designation=@Designation,Type=@UserType,Reportsto=@reportsTo where empid=@id";
cmd.Parameters.Add("@Empname",SqlDbType.VarChar).Value = ((TextBox)e.Item.Cells[1].Controls[0]).Text;--- i got this error in this line cmd.Parameters.Add("@pwd", SqlDbType.VarChar).Value = ((TextBox)e.Item.Cells[2].Controls[0]).Text; }
I create the View which consist of multiple same table. When I want to update via the View, it doesn't allow me to update it, it gave out the following message, View or function 'Table1' is not updatable because the modification affects multiple base tables.
I have a prject I am working on that uses a database connection to SQL Express 2005 to look up info of a person. The question I have is that I downloaded some code from a tutorial and it works fine but has some extra info that I dont want to use for example it saves FirstName, LastName, Title, Adress, Phone # in a table but I only want to use the Firstname, LastName and Phone# in the table but when I take these out of the Table with the wizard the Update Button I have has a error saying it is not parameterized and is missing Adress, Title am I missing something here? I can leave the Adress and Title in the table and just not have them on my Form and it works fine but I would like to get rid of the unwanted parameters from the table and have my Update Button work.
The clients are able to connect and pull data on existing accounts. However when users try to create a new version of an existing account or an actual new account, they get:
Db UpDate Error
ERROR 40002 01000: [Microsoft][ODBC SQL Server Driver][SQL Server]Command has been aborted.
Unable To Set Version Info. MODE: NEW
Class[APPOBJ.SerVersion]
Is this some type of version conflict? I've tried finding more information about the Error 40002 but I don't find the one specific to mine. I'm not an SQL expert but I would like to try and find out what the error message is trying to tell me. Any help would be greatly appreicated.
Stepping thru the code with the debugger shows the dataset rows being deleted.
After executing the code, and getting to the page presentation. Then I stop the debug and start the page creation process again ( Page_Load ). The database still has the original deleted dataset rows. Adding rows works, then updating works fine, but deleting rows, does not seem to work.
The dataset is configured to send the DataSet updates to the database. Use the standard wizard to create the dataSet.
cDependChildTA.Fill(cDependChildDs._ClientDependentChild, UserId); rowCountDb = cDependChildDs._ClientDependentChild.Count; for (row = 0; row < rowCountDb; row++) { dr_dependentChild = cDependChildDs._ClientDependentChild.Rows[0]; dr_dependentChild.Delete(); //cDependChildDs._ClientDependentChild.Rows.RemoveAt(0); //cDependChildDs._ClientDependentChild.Rows.Remove(0); /* update the Client Process Table Adapter*/ // cDependChildTA.Update(cDependChildDs._ClientDependentChild); // cDependChildTA.Update(cDependChildDs._ClientDependentChild); } /* zero rows in the DataSet at this point */ /* update the Child Table Adapter */ cDependChildTA.Update(cDependChildDs._ClientDependentChild);
Hello I am trying to update a column containing URL's and include the "www." which had previously been omitted on many URL's in the column. But I get an error when trying to UPDATE I have tried: UPDATE table_nameSET URL = http://www.a2zdom.com/*WHERE URL = http://a2zdom.com/* I have tried and left out the http: and also the /* but nothing works. Is this type of update not possible? Thanks
Hi:I am trying to update a UserInfo record using a stored procedure. It uses a uniqueidentifier UserId as the primary key. I keep getting an error and am trying to trip it using try-catch statements in both SQL Server Express and VWD 2005.My challenge is that I cannot enter a sample UserId to test the query in SQL Server because it sees my unique identifier as a string and I cannot get the error back to VWD to see where the problem is. The stored procedure looks something like:ALTER PROCEDURE [dbo].[UpDateUserInfo] @Userid uniqueidentifier, @FirstName nvarchar(50), @LastName nvarchar(70), @WorkPhone nvarchar(50),ASBEGIN TRY SET NOCOUNT OFF; UPDATE Members SET FirstName = @FirstName, LastName = @LastName, WorkPhone = @WorkPhone, CellPhone = @CellPhone WHERE UserID = @Userid;END TRYBEGIN CATCH EXECUTE usp_GetErrorInfo;END CATCH; CREATE PROCEDURE [dbo].[usp_GetErrorInfo]AS SELECT ERROR_NUMBER() AS ErrorNumber, ERROR_SEVERITY() AS ErrorSeverity, ERROR_STATE() AS ErrorState, ERROR_PROCEDURE() AS ErrorProcedure, ERROR_LINE() AS ErrorLine, ERROR_MESSAGE() AS ErrorMessage; When I put in the value d2dbf5-409d-4ef4-9d35-0a938f6ac608 which is an actual UserId in SQL server when I execute, the program tells me there incorrect syntax. So I would greatly appreciate it if somebody could help me with the following two questions: 1. How do I input a uniqueidentifier when executing a query in SQL Server Express?2. How can I get any errors that I trap (I think I have the right set up here) to show up back in my ASP.Net application? Any help greatly appreciate.Roger Swetnam
string cmdTxt = "Update penberry_SubjectName set SubjectLeaderId IN ( SELECT userid FROM aspnet_users WHERE username = @subjectLeaderName) where SubjectCode = @subjectCode";
SqlConnection sqlconn = new SqlConnection(sqlConnStr); SqlCommand sqlCmd = new SqlCommand(cmdTxt, sqlconn);
Im getting this error when i try to change my value of my int RoleID: UPDATE statement conflicted with COLUMN FOREIGN KEY constraint 'Roles_Users_FK1'. The conflict occurred in database 'lyngso', table 'Roles', column 'RoleID'.The statement has been terminated.
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.Data.SqlClient.SqlException: UPDATE statement conflicted with COLUMN FOREIGN KEY constraint 'Roles_Users_FK1'. The conflict occurred in database 'lyngso', table 'Roles', column 'RoleID'.The statement has been terminated.
Source Error:
Line 373: tryLine 374: {Line 375: rowsAffected = dbCommand.ExecuteNonQuery();Line 376: }Line 377: finallyThe code that courses this error should be this code from my DatabaseHandler class:... queryString = "SELECT unitID FROM Units WHERE containerID = @containerID AND logDateTime = @logDateTime"; dbCommand = new SqlCommand(queryString, dbConnection); //ContainerID Param IDataParameter dbParam_containerID = new SqlParameter(); dbParam_containerID.ParameterName = "@containerID"; dbParam_containerID.Value = containerID; dbParam_containerID.DbType = System.Data.DbType.String; dbCommand.Parameters.Add(dbParam_containerID); //LogDateTime Param IDataParameter dbParam_logDateTime = new SqlParameter(); dbParam_logDateTime.ParameterName = "@logDateTime"; dbParam_logDateTime.Value = logDateTime; dbParam_logDateTime.DbType = System.Data.DbType.DateTime; dbCommand.Parameters.Add(dbParam_logDateTime);...The logDateTime param comes as a param to the method this code i located in. In my database the two tables are created as the following:CREATE TABLE [dbo].[Roles] ( [RoleID] [int] IDENTITY (1, 1) NOT NULL , [Name] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [RoleLevel] [int] NOT NULL ) CREATE TABLE [dbo].[Users] ( [UserID] [int] IDENTITY (1, 1) NOT NULL , [Firstname] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Lastname] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [varchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Phone] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [MobilPhone] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [IsActive] [bit] NOT NULL , [RoleID] [int] NOT NULL ) To me it all looks fine, but my application doesn't agree with me....can anybody help here?
The trigger does set my CommAudit field to 1 when imaSlsCls is changed, but at the end of the day when I issue the UPDATE command to set all CommAudit back to 0 I get an error. Is there a differant way to make it work?? See trigger, update command & error below. Thanks for any help, Tom
*** TRIGGER *** CREATE TRIGGER [tblItemMaster_utr] ON dbo.tblItemMaster FOR UPDATE AS IF (select imaSlsCls from inserted) <> (select imaSlsCls from deleted) BEGIN update tblItemMaster set commaudit = 1 from inserted, tblItemMaster where inserted.imaitnbr = tblItemMaster.imaitnbr END
*** UPDATE COMMAND *** UPDATE tblItemMaster SET CommAudit = 0 WHERE CommAudit = 1
*** ERROR *** Server: Msg 512, Level 16, State 1, Procedure tblItemMaster_utr, Line 5 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. The statement has been terminated.
hi, someone please tell me what's wrong with this update statement It's supposed to get values for employee location from a test table, based on the first name and last name match, and update the outer table. I get this error...
Server: Msg 170, Level 15, State 1, Line 1 Line 1: Incorrect syntax near 'a'.
update abs_employee a set a.office_location = (select b.Location from abs_emptest b where b.lastname = a.last_name and b.firstname = a.first_name)
I am getting an error message when trying to run this update statement:
update table1 set col1 = (select substring(col2,1,2) + '-' + substring(col2,3,7) from table1)
Error message:
Server: Msg 512, Level 16, State 1, Line 1 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. The statement has been terminated.