Update Record Query
Mar 31, 2008
Hi
I have a column in a table which has html text. Eg
<p>[Video:-123xyz] <br />A video showing blah blah</p>
I wish to update the data between the two square brackets within the rest of the text to:
<p>[View:http://www.video123.com/-123xyz] <br />A video showing blah blah</p>
...so basically i need to find all occurrences of '[Video:' and replace it with '[View:http://www.video123.com/' .
Please can someone point me in the right direction?
cheers
View 14 Replies
ADVERTISEMENT
Jul 3, 2007
How do I update a record that has duplicates. For example, I have 3612 orders some of these orders have multiple orderid's I want to update the record for each of these orders that was added most recently.
View 5 Replies
View Related
Aug 16, 2006
I am trying to update a record in a table based off of criteria of another record in the table.
So suppose I have 2 records
ID owner type
1 5678 past due
2 5678 late
So, I want to update the type field to "collections" only if the previous record for the same record is "past due". Any ideas?
View 5 Replies
View Related
Mar 26, 2008
Hi All,
I am trying to create package something like that..
1- New Customer table as OleDB source component
2- Lookup component - checks customer id with Dimension_Customer table
3- And if same customer exist : I have to update couple fields on Dimension_Customer table
4- if it does not exist then I have insert those records to Dimension_Customer table
I am able to move error output from lookup to Dimension_Customer table using oledb destination
but How can I update the existing ones?
I have tried to use oledb command but somehow it didnt work
my sql was like this : update Dimension_Customer set per_X='Y', per_Y= &Opt(it should come from lookup)
I will be appreciated if you can help me...
View 3 Replies
View Related
Jan 3, 2005
hi!
I have a big problem. If anyone can help.
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?
Is there any other way to do this?
can DBCC help to retrieve this info?
Please advise me how to do this.
Thanks in advance.
Vaibhav
View 10 Replies
View Related
Apr 7, 2008
Hi,
We're running a Sage CRM install with a SQL Server 2000 database at the back end. We're using the Sage web services API for updating data and a JDBC connection to retrieve data as it's so much quicker.
If I retrieve a record using the JDBC connection and then try and update the same record through the web services, the query times out as if the record is locked for updates. Has anyone experienced anything similar or know what I'm doing wrong? If I just use DriverManager.getConnection() to establish the connection instead of the datasource, and then continue with the same code I don't get these record locking problems. Please find more details below.
Thanks,
Sarah
The JDBC provider for the datasource is a WebSphere embedded ConnectJDBC for SQL Server DataSource, using an implementation type of 'connection pool datasource'. We are using a container managed J2C authentication alias for logging on.
This is running on a Websphere Application Server v6.1.
Code snippet - getting the record thru JDBC:
DataSource wsDataSource = serviceLocator.getDataSource("jdbc/dsSQLServer");
Connection wsCon = wsDataSource.getConnection();
// wsCon.setAutoCommit(false); //have tried with and without this flag - same results
Statements stmt = wsCon.createStatement();
String sql = "SELECT * FROM Person where personID = 12345";
ResultSet rs = stmt.executeQuery(sql);
if(rs.next()){
System.out.println(rs.getString("lastName"));
}
if (rs != null){
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (wsCon != null) {
wsCon.close();
}
View 1 Replies
View Related
Jun 6, 2007
I am looking for some guidence on the following.
when i click the save button, The record should be updated to the table. I have produced the code below which does'nt seem to work. Please guide me
It works fine when i hard code the value for "textbox value" in line SqlDataSource1.UpdateParameters.Item("PrmVal").DefaultValue = "Textbox value"
Protected Sub SaveRecord(ByVal sender As Object, ByVal e As System.EventArgs) If Page.IsValid Then SqlDataSource1.UpdateParameters.Item("PrmVal").DefaultValue = Textbox value SqlDataSource1.Update() end ifend sub
<form id="form1" runat="server"> <div> </div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:BmsConnectionString %>" SelectCommand="SELECT [PrmGrp], [PrmCde], [PrmVal], [PrmValArb], [GrpDsc] FROM [PrmDef] WHERE (([PrmGrp] = @PrmGrp) AND ([PrmCde] = @PrmCde))" UpdateCommand="UPDATE PrmDef SET PrmVal=@PrmVal, PrmValArb=@PrmValArb, GrpDsc=@GrpDsc,RecSts=1 WHERE (([PrmGrp] = @PrmGrp) AND ([PrmCde] = @PrmCde))"> <SelectParameters> <asp:QueryStringParameter Name="PrmGrp" QueryStringField="PrmGrp" Type="String" /> <asp:QueryStringParameter Name="PrmCde" QueryStringField="PrmCde" Type="String" /> </SelectParameters> <Updateparameters> <asp:parameter Name="PrmGrp" /> <asp:parameter Name="PrmCde" /> <asp:parameter Name="PrmVal" /> <asp:parameter Name="PrmValArb" /> <asp:parameter Name="GrpDsc" /> <asp:parameter Name="RecSts" /> </Updateparameters> </asp:SqlDataSource> <asp:FormView ID="FormView1" runat="server" DataKeyNames="PrmGrp,PrmCde" DataSourceID="SqlDataSource1" DefaultMode="Edit" Width="670px" style="left: 12px; position: relative; top: 12px; z-index: 100;" Height="359px" BorderStyle="Double" BorderWidth="5px" CaptionAlign="Top" GridLines="Both" BorderColor="Maroon" CellPadding="2"> <EditItemTemplate> <br /> Parameter Group: <asp:Label ID="PrmGrp" runat="server" Text='<%# Eval("PrmGrp") %>' style="left: 34px; position: relative; top: 0px" Width="125px"></asp:Label><br /> <br /> Parameter Code: <asp:Label ID="PrmCde" runat="server" Text='<%# Eval("PrmCde") %>' style="left: 40px; position: relative; top: 0px" Width="125px"></asp:Label> <br /> <br /> English description: <asp:TextBox ID="PrmValTextBox" runat="server" Text='<%# Bind("PrmVal") %>' style="left: 17px; position: relative; top: 0px" Width="318px"></asp:TextBox> <br /> Arabic description: <asp:TextBox ID="PrmValArbTextBox" runat="server" Text='<%# Bind("PrmValArb") %>' style="left: 25px; position: relative; top: 0px" Width="317px"></asp:TextBox><br /> <br /> Group description: <asp:TextBox ID="GrpDscTextBox" runat="server" Text='<%# Bind("GrpDsc") %>' style="left: 29px; position: relative; top: 4px" Width="316px"></asp:TextBox><br /> <br /> <asp:Button ID="CmdSave" runat="server" OnClick="SaveRecord" Style="left: 134px; position: relative; top: 49px" Text="Save" Width="72px" /> <asp:Button ID="CmdDelete" runat="server" OnClick="DeleteRecord" Style="left: 145px; position: relative; top: 50px" Text="Delete" Width="79px" /> <asp:Button ID="CmdClose" runat="server" OnClick="CloseWindow" Style="left: 160px; position: relative; top: 48px" Text="Close" Width="73px" /><br /> <br /> <asp:Label ID="ErrLabel" runat="server" Font-Bold="True" Font-Size="Small" ForeColor="#C00000" Style="left: 148px; position: relative; top: -38px" Text="Fields marked as (*) are required" Visible="False" Width="318px"></asp:Label><br /> </EditItemTemplate> <ItemTemplate> PrmGrp: <asp:Label ID="PrmGrpLabel" runat="server" Text='<%# Eval("PrmGrp") %>'></asp:Label><br /> PrmCde: <asp:Label ID="PrmCdeLabel" runat="server" Text='<%# Eval("PrmCde") %>'></asp:Label><br /> PrmVal: <asp:Label ID="PrmValLabel" runat="server" Text='<%# Bind("PrmVal") %>'></asp:Label><br /> PrmValArb: <asp:Label ID="PrmValArbLabel" runat="server" Text='<%# Bind("PrmValArb") %>'></asp:Label><br /> GrpDsc: <asp:Label ID="GrpDscLabel" runat="server" Text='<%# Bind("GrpDsc") %>'></asp:Label><br /> </ItemTemplate> <HeaderStyle BorderStyle="Double" BackColor="#FFC0C0" BorderWidth="5px" BorderColor="Black" HorizontalAlign="Center" VerticalAlign="Middle" /> <HeaderTemplate> Business parameter(Edit) </HeaderTemplate> <RowStyle BorderWidth="5px" /> </asp:FormView> </form>
View 4 Replies
View Related
Jul 18, 2007
Hi everybody,I am using SQL Server 2005. I have a table which currently has only 1 record. I am unable to update any field for this particular record and SQL server is timing out and giving an error message saying No row was updated. I created another record in the table and tried to update the fields in the new record without any problem. I am unable to update any field only for the 1 record in the table using my application, query window sql statement as well as directly changing the in the database.Can anybody please help me.thanks in advance,Murthy here
View 3 Replies
View Related
May 15, 2008
I am in a situation in which I would like to update my one table three column with other table three column, The other table might have more then one record but I would like to have the TOP 1 record of that table for these column. How can I achive it. I know I will be able to achive by writing three statment like
Update abc
set a=(select top 1 a from xyz order by ),
b=( select top 1 b from xyz) and so but not sure that a and b using the same record and thats the requirment of update is
any help much apprecited
View 1 Replies
View Related
Jul 23, 2005
Hello,update table set column = x where b is nullI have the above update statement in a transact sql file. I would liketo change it so that it will only update 1 of the records in the table,even if there are many records where b is null....Any ideas would be great.Many thanks,Allan
View 1 Replies
View Related
Jul 23, 2005
HiI've a table with 2 columns, one for a client code and one for adate/time and could be more than one record with the same client codeand date/time. the 3rd column is another date/time, NULL by default.I need to check if exists records for a determinated client code anddate/time and place the current date/time in the 3rd column for just oneand only one record.Is this possible ? How ?Thanks in advanceJ
View 9 Replies
View Related
Feb 1, 2008
I'm very surprised since I cannot do a simple update operation...
Seems that the cursor after a Read, Readfirst, ReadLast or ReadPrevious is gone...
Here is a possible sequence from the user's standpoint.
1) Performs a QBE search
cmd_Logbook_search = Conn_User.CreateCommand()
cmd_Logbook_search.CommandText = sql_Logbook
rset_Logbook = cmd_Logbook_search.ExecuteResultSet(ResultSetOptions.Updatable Or ResultSetOptions.Scrollable)
-----
If rset_Logbook.HasRows = False Then Exit Sub
rset_Logbook.ReadFirst()
Me.Fill_Logbook_TextBoxes()
2) Navigates
Try
If True = rset_Logbook.Read() Then
Me.Fill_Logbook_Textboxes()
Else
rset_Logbook.ReadLast()
Me.Fill_Logbook_Textboxes()
End If
Catch ex As Exception ' esta excepción se levanta si el recordset está vacio
MessageBox.Show(m11, m1, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
End Try
3) Update the record
If Result = DialogResult.Yes Then
Try
rset_Logbook.SetValue(rset_Logbook.GetOrdinal("Altitude"), Me.TextBox_Altitude.Text)
rset_Logbook.Update()
MessageBox.Show("OK", m1, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
Catch ex As Exception
MessageBox.Show(ex.message, m1, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
End Try
End If
And I always gets a "No data exist for row/colum" so...where did the cursor gone?
Any help, please I need to move forward! Thanks a lot in advance!!
View 7 Replies
View Related
Jul 10, 2007
Hi
I am new to visual studio and I am attempting to edit records held in mysql, the code below runs and throws no errors "strAdd" is underlined and says that it is used before it has been given a value! But If I debug.print(strAdd) I get the expected string returned. What do I need to do to get the updated records saved?
' code
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim StrAdd as string
cn = New ADODB.Connection
cn.ConnectionString = "Provider=SQLNCLI;" _
& "Server=(local);" _
& "Database=customerlink;" _
& "Integrated Security=SSPI;" _
& "DataTypeCompatibility=80;" _
& "MARS Connection=True;"
Dim mySQL As String
mySQL = "SELECT *" & _
" FROM tblvsol" & _
" Where RevStatus = " & 0 & _
" And GeoCodeStatus = " & 1
cn.Open()
rs = New ADODB.Recordset
With rs
.ActiveConnection = cn
.CursorLocation = ADODB.CursorLocationEnum.adUseClient
.CursorType = ADODB.CursorTypeEnum.adOpenDynamic
.LockType = ADODB.LockTypeEnum.adLockBatchOptimistic
.Open(mySQL)
End With
Do While Not rs.EOF
Code here finds the value for the string variable €˜atrAdd€™
strAdd = New Value
If Not strAdd Is Nothing Then
rs.Fields("location").Value = strAdd
rs.Fields("RevStatus").Value = 1
rs.Update()
else
end if
loop
Regards
Joe
View 9 Replies
View Related
Feb 22, 2008
How do I tell an update query to do the update only to one row in the table, and if there s more than one row in the where clause, then not to do the update.
Something like this:
update top 1 set myCol='value' where searchCol='criteria'
But that causes an error.
View 6 Replies
View Related
May 4, 2004
Hello,
I was stuck when update database using SqlDataAdapter. I have several textboxes in my webform1. When wepform1 is loaded, they will display user's information. The user can only input content in two textboxes. When user clicks the update button, I hope to update this record in SQL Server 2000 database. However, the program didn't work. There was no error message reported but when I stepped into the code, I found out that dataadapter's update method didn't succeed. I got 0 rows affected. Can I get some advice from someone ?
Here is the code:
string StrUpdateCmd = "Update Table1 Set Hphone = @Hphone, Cphone = @Cphone, Team = @Team Where emailname =@emailname ";
SqlDataAdapter UpdateDa = new SqlDataAdapter("Select * from Table1",SqlConnection1);
UpdateDa.UpdateCommand = new SqlCommand(StrUpdateCmd, SqlConnection1);
//Add parameters of update command.
SqlParameter prm1 = UpdateDa.UpdateCommand.Parameters.Add("@Hphone",SqlDbType.NVarChar, 16);
prm1.Value = txtHphone.Text ;
SqlParameter prm2 = UpdateDa.UpdateCommand.Parameters.Add("@Cphone",SqlDbType.NVarChar, 16);
prm2.Value = txtCphone.Text ;
SqlParameter prm3 = UpdateDa.UpdateCommand.Parameters.Add("@Team",SqlDbType.NVarChar, 16);
prm3.Value = this.DropDownList1.SelectedItem.Value ;
SqlParameter prm4 = UpdateDa.UpdateCommand.Parameters.Add("@emailname",SqlDbType.NVarChar, 50);
prm4.Value = txtEmail.Text;
try
{
DataSet dataset2 = new DataSet();
//Open database connection.
SqlConnection1.Open();
dataset2.Clear();
UpdateDa.Fill(dataset2, "Table1");
this.DataGrid1.DataSource = dataset2.Tables[0] ;
DataGrid1.DataBind ();
//Update database
int ret =UpdateDa.Update(dataset2,"Table1");
if( ret == 1 )
{
ShowMessage("Update succeed!");
}
else
{
ShowMessage("There is an error in updating ");
}
UpdateDa.Fill(dataset2);
//Show data after update.
this.DataGrid1.DataSource = dataset2;
DataGrid1.DataBind ();
}
catch (Exception ex)
{
throw ex;
}
finally
{
sqlConnection1.Close();
}
View 1 Replies
View Related
Oct 14, 2001
Can anyone help with an effective way in retriving the id of the new record before input of any data into a form. We have a form where a few of the controls recordsource requires the new record id before they will display correctly. I have tried various ways to trigger the form afterupdate event in the hope that the id will be returned but get the error message "The data will be added to the database but the data won't be displayed in the form because it doesn't satisfy the criteria in the underlying recordsource"
Thanks in advance
View 1 Replies
View Related
Jul 12, 2007
This should be incredibly simply but I've been working on it for quite a while and have had no luck:
There's ONE table with many columns but I'm only interested in three columns.
DistrictLEA
SSN
And a third column titled DistrictLEASSN
This is an odd scenario but I need to concatenate DistrictLEA + SSN for each record and update DistrictLEASSN with the result.
Is there a good method to do this with T-SQL/Cursors?
UPDATE DistrictLEASSN
SET DistrictLEASSN= DistrictLEA + SSN
I'd like to loop through each record in the table and perform the operation.
Thanks! -CD
View 6 Replies
View Related
Mar 4, 2005
here is my trigger that i have right now the only problem is that it deletes the records before copying everything into the db i dont what do delete everything i just whant to catch the updated record and then update the other tables same record in the other db how would i do this:
right now i have this
CREATE TRIGGER test ON [dbo].[TEST123]
AFTER INSERT, UPDATE, DELETE
AS
IF @@ROWCOUNT = 0
RETURN
IF (COLUMNS_UPDATED() & 2 = 2)
DELETE FROM pubs..TEST123 WHERE test3 = '300'
INSERT INTO pubs..TEST123
SELECT * FROM TEST123 WHERE test3 = '300'
UPDATE pubs..TEST123 SET test1 = 'X' WHERE test1 IS NULL AND test3 = '300'
UPDATE pubs..TEST123 SET test2 = 'X' WHERE test2 IS NULL AND test3 = '300'
UPDATE pubs..TEST123 SET test3 = 'X'
View 2 Replies
View Related
Mar 23, 2006
Hi everybody,
I have 2 fields in a table.
Table Name--- StudentDetail
Name Address
Saju Kerala
Balaji Bangalore
Raj Kumar Tamilnadu
Saju Kerala
I want to Update one of the duplicate row as I don't have any unique id column. So can anybody update one of the the duplicate record without using any id or altering any column.
I am waiting for your reply.................
Regards,
Saju S.V
View 1 Replies
View Related
Apr 20, 2004
Please tell me how to code the Update of the current cursor record as one would do using VD/ADO :
VB: Table("Fieldname") = Value
----------------------------------------------------------
Declare @NextNo integer
Select @NextNo = (Select NextNo from NextNumbers where NNId = 'AddressBook') + 1
--Create a Cursor through wich to lo loop and Update the ABAN8 with the corrrect NextNo
DECLARE Clone_Cursor CURSOR FOR Select ABAN8 from JDE_Train.trndta.F0101_Clone
Open Clone_Cursor
Fetch Next from Clone_Cursor
WHILE @@FETCH_STATUS = 0
BEGIN
Select @NextNo = @NextNo + 1
Clone_Cursor("ABAN8") = @NextNo
Update Clone_Cursor
FETCH NEXT FROM Clone_Cursor
END
CLOSE Clone_Cursor
DEALLOCATE Clone_Cursor
GO
View 1 Replies
View Related
May 30, 2008
Using trigger
want to update a field being inserted from another record in the same table.
the record being inserted I want to pull the bkjrcode from another record where the account = 1040 that also has the same ord# and inv# as the record being inserted.
Here is what I've tried with no luck.
create trigger [updategbkmut] on [dbo].[gbkmut]
after insert
as
update g1
set g1.bkjrcode = g2.bkjrcode
from gbkmut g1
inner join inserted i
on i.ord_no = g1.ord_no and i.inv_no = g1.inv_no
inner join gbkmut g2
on i.ord_no = g2.ord_no and i.inv_no = g2.inv_no
where i.freefield3 = 'Rebate' and g1.account = '1040'
View 2 Replies
View Related
Jun 9, 2008
I have a queue in service broker, which gets messages with a stored procedure which is invoked from VS application. The messages are properly stored in queue. I want to receive these messages one after the other and put it into a table. I am fetching the messages in a while loop which breaks when messages are over.
The first record is inserted properly. In the next iteration of the loop I want to append the next message data in that same record. This will continue for approximately 10 minutes after which a new record will be created. When I attempt to append the data in first record that record is not being read even though I have used isolation level read uncommitted.
What is it that I am missing to achieve the desired results?
Gouri Sohoni
View 4 Replies
View Related
Mar 13, 2014
We are developing a database in SQL and we are trialing some of our typical analysis undertaken on out dataset.
I have a problem with a update function. ID direction Holiday Lat Long Speed obstime - Datestamp LicenseID - varchar(7) status - int (0 or 1) O-Unoccipied, 1-occupied Pickup - Boolean Dropoff - Boolean
I am trying to update the 'Pickup' or 'Dropoff' when the status changes from 0 to 1 or from 1 to 0 if the difference in the datestamp is less than 2 minutes. Pickup is when the status goes from 0 to 1 Drop off is when the status goes from 1 to 0
View 2 Replies
View Related
Nov 2, 2005
How to update the Last Update Date of a modified record? I want to put this in table trigger .
Or any setting can be used?
Please help~~~~
View 20 Replies
View Related
Feb 27, 2006
Hi SQL gurus,
I have a form that depending on the outcome, will either add, update or delete a record.
1) If there IS NO record of "this" and "that" and Request("x") <> "" it will add a new record.
2) If there IS a record for "this" and "that" and Request("x") <> "" it will update column 1,2,3 or 4.
3) If there is a record for "this" and "that" and Request("x") = "" it will delete the record.
My problem is if there is a value in request("1") it works fine, but if there is no value in ("1") and there is a value in 2, 3, or 4 it will delete the record.
If request("1") <> "" OR request("2") <> "" OR request("3") <> "" OR request("4") <> "" Then
sSQL = "SELECT * FROM some_column WHERE this = '" & request("this) & "' and that = '" & request("that) & "'"
oRS.Open sSQL,oConn,adOpenKeySet,adLockOptimistic
If oRS.EOF Then
oRS.Addnew
oRS.Fields("this") = request("this")
ors.Fields("that") = request("that")
Else
ors.Movefirst
End If
oRS.fields("1") = request("1")
oRS.fields("2") = request("2")
oRS.fields("3") = request("3")
oRS.fields("4") = request("4")
oRS.Update
oRS.Close
Else
sSQL = "Delete from some_table Where this = '" & '" & request("this) & "' & "' AND that = '" & '" & request("that) & "' & "'"
objCmd.ActiveConnection = oConn
objCmd.CommandType = adCmdText
objCmd.CommandText = sSQL
objCmd.Execute
End if
Hope I explained that okay.
View 1 Replies
View Related
Mar 12, 2008
Hello All,I have 2 tables in a MS SQL DB. Table1 and Table2.LogTable2.Log was a copy of Table1 + an extra column for date_deleted. Ihave 2 Triggers on Table1, Insert and delete. So when a record isinserted into Table1 it's copied onto Table2.log, and when deleted inTable1 the same record in Table2.log is time stamped with time ofdeletion.I would like to have another Trigger on Table1 for update. So if acertain field (not primary key) is updated for a record it is alsoupdated in Table2.log This way Table2.log will always have exactly thesame fields per record as Table1.I'm not sure how to reference the modified records only and updatejust the modified fields...something like...?----------------------------CREATE TRIGGER [tr_updateT_Log] ON [dbo].Table1FOR UPDATEASUpdate Table2.LogSET description = , office =-------------------------------------------------Any help would be greatly appreciatedThanksY
View 2 Replies
View Related
Jun 12, 2006
I have a table as shows here:
col1 col2
1 rec1 *
2 rec1
3 rec1
4 rec2 *
5 rec2
6 rec2
and now I need to update the field col1 of the first records with
different col2 value. that means I need to update the col1 filed of the
* marked record.
any suggestion about how to do it with SQL server 2000?
thanks a lot.
View 1 Replies
View Related
Apr 12, 2008
hi,
i use SSB to insert records in my database. can i use SSB to update a record?
View 1 Replies
View Related
Feb 13, 2007
Hi,I'm trying to create a registration page that I've divided into multiple pages (first page for basic details, next page for address, etc.). I insert the record in the first page, and update it in the other pages. I pass the newly created ID to the other pages using the Page.PreviousPage property. In the second page, I have the SqlDataSource configured as "SELECT * FROM [Table] WHERE ID = ?", and the UpdateCommand is "UPDATE .... WHERE ID = ?". In Page_Load, I am updating the SelectCommand to "SELECT ... WHERE ID = " & intID, and the UpdateCommand similarly. The I do a dtlsvw.Databind()But when I go to the next page (the newly created ID is being passed properly), the update doesn't do anything. The new record doesn't contain the values in the detailsview. Can somebody help me out? Thanks,Wild Thing
View 2 Replies
View Related
Apr 13, 2007
I'm entering a Selection record for a partiuclar lotID,
Once entered, I need to obtain its SelectionID then use it to update a another field within that record.
Here's what I've been doing...
--insert values into a testchangeorders table
INSERT INTO testchangeorders VALUES (2,3,3,3,1,'red',0,5)
--Find the SelectionsID of the last record created for that partiuclar LotID
SELECT MAX (SelectionsID)
FROM testchangeorders
WHERE LotID = 2
--Once located, I was trying to update a field called uniqueID with a contantination of '3-' & the record's SelectionsID
UPDATE testchangeorders
SET UniqueID = ('3-' & SelectionID
WHERE SelectionsID = SELECT MAX (SelectionsID) AND LotID = 2)
View 7 Replies
View Related
Jan 2, 2006
I really want to update just one cell without notify the others in record ,but i can not.
example; my table like this.
ID
Increasingnumber
LastModified
1
15
1/1/1900
i want to modify the "increasingnumber" cell only and also not let "LastModify" cell being updated. Can anyone help me solve this problem?
View 6 Replies
View Related
May 6, 2006
Well, I really messed up. Instead of changing the name of a current company record in a table I changed ALL the company names in the table. Me.CustomerDataSource.SelectCommand = "UPDATE tbl_customers SET company = '" & companyTextBox.Text & "'"
So, I need to insert a WHERE clause to fix this. My problem is that I've been searching everywhere for this simple command structure and cannot find anything that specifically addresses a simple way to reference the current record.
I tried...Me.CustomerDataSource.SelectCommand = "UPDATE tbl_customers SET company = '" & companyTextBox.Text & "' WHERE recno = @recno"
But I get the error:
Exception Details: System.Data.SqlClient.SqlException: Must declare the scalar variable "@recno".
Can anyone provide this simple query clause?
View 2 Replies
View Related
Jul 1, 2001
We have a website that allows people to enter tasks and they are then given a stageID. ie 1 which is review for when they are first entered into our database. If they have not been reviewed in 5 minutes I want them to update automatically and move onto the next stage. I have tried using a stored procedure that adds the reocrd with a waitfor command but that doesn't work because it locks the connection ofcourse until it's finished the stored procedure which means the webpage doesn't come back for 5 minutes which we don't need. I'm asking if there is any other way I can do this without a waitfor command or somehow use it so that it doesn't hold the current connection.
Thanks for your help
Jason
View 1 Replies
View Related