Returnvalue Not Accepted In Update / Delete Command

Dec 13, 2005

Hi,

I tried to use the RETURN_VALUE of a stored procedure in updata / delete commands with a sql-datasource and a stored procedure.

The thing works fine with the insert command.
But it fails with "too many arguments..." in delete / update.

I also tried to handle the updating event like this:


protected void sqldsReportSelect_Updating(object sender, SqlDataSourceCommandEventArgs e) {
   SqlParameter sqP = new SqlParameter("RETURN_VALUE", SqlDbType.Int);
   sqP.Direction = ParameterDirection.ReturnValue;
   e.Command.Parameters.Add(sqP);
}

It brings the same error.

Do I make something wrong or is this a bug?

Regards

Manfred

View 2 Replies


ADVERTISEMENT

Is There A Way To Know The Condition In An Update/Delete Command Inside A SP?

May 7, 2008



Hi to all:

I'm trying to make a sp who generates an export string for everey sql command, for example: Insert, update and delete. In the case of Insert I just have the sp, but in "update" and "delete" commands... how can I know the conditions?..

UDTATE DemoTable SET DemoField=77 WHERE (Condition1 AND Condition2)

....may I use a comparative with 'updated' table?, please help me with your ideas

Thanks a lot.

View 4 Replies View Related

OLEDB Command Usage When Update/delete On Db2

Dec 11, 2007



We have SS2K5 source and DB2 Target. I downloaded and installed MS OLE DB provider for DB2. It is configured correctly. The data insert works fine. But I am having problem with update/delete on DB2 when passing string parameters.

The OLEDB command works fine when I hard code the values:
delete from TableName where Col1='abc' and Col2='xyz'

But when I use parameters the package executes successfully, but the data is not delete on DB2.

Any one having similar experience or solution for this is really appreciated.

Thanks,


View 7 Replies View Related

CAN I Command (INSERT, DELETE, UPDATE) 2 Tables At The Same Time? POSSIBLE? HOW?

Apr 25, 2008

i've read the transact-sql command,
i known that the select command use to retrieve many fields from many tables with one command
select * from table1,table2
yes,
but i ' ve not seen the way to add,delete or update those fields from those tables with one command...

Is it possible? why?
I don't have any idea , can u help me
I want to know the sql commands , if it's possible

thanks for reply,
mochi

View 3 Replies View Related

Defining Command,commandtype And Connectionstring For SELECT Command Is Not Similar To INSERT And UPDATE

Feb 23, 2007

i am using visual web developer 2005 and SQL 2005 with VB as the code behindi am using INSERT command like this        Dim test As New SqlDataSource()        test.ConnectionString = ConfigurationManager.ConnectionStrings("DatabaseConnectionString1").ToString()        test.InsertCommandType = SqlDataSourceCommandType.Text        test.InsertCommand = "INSERT INTO try (roll,name, age, email) VALUES (@roll,@name, @age, @email) "                  test.InsertParameters.Add("roll", TextBox1.Text)        test.InsertParameters.Add("name", TextBox2.Text)        test.InsertParameters.Add("age", TextBox3.Text)        test.InsertParameters.Add("email", TextBox4.Text)        test.Insert() i am using UPDATE command like this        Dim test As New SqlDataSource()        test.ConnectionString = ConfigurationManager.ConnectionStrings("DatabaseConnectionString").ToString()        test.UpdateCommandType = SqlDataSourceCommandType.Text        test.UpdateCommand = "UPDATE try SET name = '" + myname + "' , age = '" + myage + "' , email = '" + myemail + "' WHERE roll                                                         123 "        test.Update()but i have to use the SELECT command like this which is completely different from INSERT and  UPDATE commands   Dim tblData As New Data.DataTable()         Dim conn As New Data.SqlClient.SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database.mdf;Integrated                                                                                Security=True;User Instance=True")   Dim Command As New Data.SqlClient.SqlCommand("SELECT * FROM try WHERE age = '100' ", conn)   Dim da As New Data.SqlClient.SqlDataAdapter(Command)   da.Fill(tblData)   conn.Close()                   TextBox4.Text = tblData.Rows(1).Item("name").ToString()        TextBox5.Text = tblData.Rows(1).Item("age").ToString()        TextBox6.Text = tblData.Rows(1).Item("email").ToString()       for INSERT and UPDATE commands defining the command,commandtype and connectionstring is samebut for the SELECT command it is completely different. why ?can i define the command,commandtype and connectionstring for SELECT command similar to INSERT and UPDATE ?if its possible how to do ?please help me

View 2 Replies View Related

Stored Procedure ReturnValue Always 0

Jan 26, 2007

I have the following Stored Procedure:

<code snippet>

UPDATE TRW_USERS

SET user_password = @password

WHERE (user_password = @old_password) AND (user_id = @user_id);



RETURN @@ROWCOUNT

Which when run, returns the correct values 0 if no rows updated 1 if row updated

In my C# I am doing the following:

TRW_USERSTableAdapter userAdapter = new UsersTableAdapters.TRW_USERSTableAdapter();

returnValue = Convert.ToInt32(userAdapter.sp_NewUpdatePassword(sNewHashedPassword, sOldHashedPassword, user_id));



It always returns 0 to returnValue, why?

Many thanks

Brades

View 3 Replies View Related

DeleteCommand, Stored Procedures, And ReturnValue Parameters = Can't Be Done?

Apr 18, 2007

 I've a SqlDataSource control that has stored procedures specified for each of its commands: SelectCommand, InsertCommand, UpdateCommand, DeleteCommand . And for Insert, Update and Delete, I've specified asp:parameters for each stored procedure's parameters. Now, my stored procedures all have return values, and I've successfully accessed the return values for Insert and Update, but for some reason, I'm getting very wrong results for Delete. <DeleteParameters> <asp:Parameter Name="result" Type="Int32" Direction="ReturnValue" /> <asp:Parameter Name="myID" Type="Int32" /></DeleteParameters>The moment I add my "result" with the direction ReturnValue, I instantly get a "Procedure or function <storedprocedurename> has too many arguments specified." error. I checked my SQL Profiler, and it seems that the page is passing result as an Input parameter, instead of keeping it as a ReturnValue! e.g.     exec spName @myID=1, @result=NULLwhen it should be     exec spName @myID=1I get the correct behavior with Update and Insert, so I'm wondering whether if this is a bug or by-design behavior or something very screwy with my computer?Help? Thoughts?

View 6 Replies View Related

Plz Help...update Value In Multiple Db Table Using Single 'update Command'

Mar 18, 2005

hi,friends

we show record from multiple table using single 'selectcommand'.
like....
---------
select *
from cust_detail,vend_detail
---------

i want to insert value in multiple database table(more than one) using single 'insert command'.
is it possible?
give any idea or solution.

i want to update value in multiple database table(more than one) using single 'update command'

i want to delete value in multiple database table(more than one) using singl 'delete command'
it is possible?
give any idea or solution.

it's urgent.

thanks in advance.

View 2 Replies View Related

Debugging The SQL Delete Command

Mar 16, 2008

What's the best way to debug the SQL commands with parameters? My Formview performs the INSERT and EDIT commands fine -- and I can see the results in the tables. However, my Delete command crashes -- see the error below. 
I assume that the problem is a formatting issue with an input parameter -- i see there are equality tests for the parameters before the delete is allowed --
How Can I look at these parameters to inspect them? All the types on the paranmeters look fine to me!!
          ---Jim 
 
Server Error in '/GVOps4' Application.


Input string was not in a correct format.
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.FormatException: Input string was not in a correct format.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:



[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2755599
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +112
System.String.System.IConvertible.ToInt32(IFormatProvider provider) +43
System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +293
System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +264
System.Web.UI.WebControls.SqlDataSourceView.AddParameters(DbCommand command, ParameterCollection reference, IDictionary parameters, IDictionary exclusionList, String oldValuesParameterFormatString) +557
System.Web.UI.WebControls.SqlDataSourceView.ExecuteDelete(IDictionary keys, IDictionary oldValues) +615
System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary oldValues, DataSourceViewOperationCallback callback) +75
System.Web.UI.WebControls.FormView.HandleDelete(String commandArg) +832
System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +535
System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source, EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source, EventArgs e) +109
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +132
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

 
 <asp:SqlDataSource ID="PilotReportDetail" runat="server"
ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM [FlightReport] WHERE [FlightReportID] = @original_FlightReportID AND [DateTimeEntered] = @original_DateTimeEntered AND [DateTimeFlown] = @original_DateTimeFlown AND [PilotID] = @original_PilotID AND [AircraftID] = @original_AircraftID AND [CameraPodID] = @original_CameraPodID AND [OrderID] = @original_OrderID AND [FlightHours] = @original_FlightHours AND [FlightSegments] = @original_FlightSegments AND [ReflyReason] = @original_ReflyReason" InsertCommand="INSERT INTO [FlightReport] ([DateTimeEntered], [DateTimeFlown], [PilotID], [AircraftID], [CameraPodID], [OrderID], [FlightHours], [FlightSegments], [ReflyReason]) VALUES (@DateTimeEntered, @DateTimeFlown, @PilotID, @AircraftID, @CameraPodID, @OrderID, @FlightHours, @FlightSegments, @ReflyReason)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [FlightReport] WHERE ([FlightReportID] = @FlightReportID)"
UpdateCommand="UPDATE [FlightReport] SET [DateTimeEntered] = @DateTimeEntered, [DateTimeFlown] = @DateTimeFlown, [PilotID] = @PilotID, [AircraftID] = @AircraftID, [CameraPodID] = @CameraPodID, [OrderID] = @OrderID, [FlightHours] = @FlightHours, [FlightSegments] = @FlightSegments, [ReflyReason] = @ReflyReason WHERE [FlightReportID] = @original_FlightReportID AND [DateTimeEntered] = @original_DateTimeEntered AND [DateTimeFlown] = @original_DateTimeFlown AND [PilotID] = @original_PilotID AND [AircraftID] = @original_AircraftID AND [CameraPodID] = @original_CameraPodID AND [OrderID] = @original_OrderID AND [FlightHours] = @original_FlightHours AND [FlightSegments] = @original_FlightSegments AND [ReflyReason] = @original_ReflyReason">
<SelectParameters><asp:ControlParameter ControlID="GridView1" Name="FlightReportID"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="original_FlightReportID" Type="Int32" />
<asp:Parameter Name="original_DateTimeEntered" Type="DateTime" />
<asp:Parameter Name="original_DateTimeFlown" Type="DateTime" />
<asp:Parameter Name="original_PilotID" Type="Int32" />
<asp:Parameter Name="original_AircraftID" Type="Int32" />
<asp:Parameter Name="original_CameraPodID" Type="Int32" />
<asp:Parameter Name="original_OrderID" Type="Int32" />
<asp:Parameter Name="original_FlightHours" Type="Double" />
<asp:Parameter Name="original_FlightSegments" Type="Int32" />
<asp:Parameter Name="original_ReflyReason" Type="Int32" />
</DeleteParameters>

View 2 Replies View Related

Cannot Use Alias In Delete Command

Dec 27, 2000

Why cannot I use alias in delete command when I join two table.

My query is as follows.
delete from ikw_indexed_form_approved where exists(select * from ikw_router
where ikw_indexed_form_approved.ikw_subscription_id=ikw_ subscription_id
and ikw_indexed_form_approved.ikw_indexed_name='centra al corp'
and ikw_indexed_form_approved.content_code='html'
and ikw_indexed_form_approved.ikw_subscription_id=1)

if I use like this it gives me an error
delete from ikw_indexed_form_approved A where exists(select * from ikw_router
where A.ikw_subscription_id=ikw_subscription_id
and A.ikw_indexed_name='centraal corp'
and A.content_code='html'
and A.ikw_subscription_id=1)

Your help will be appreciated.
Thanks in advance

View 3 Replies View Related

Delete Command Failed

Nov 10, 1999

Hi

I am using SQL 6.5. I have a master table which is referenced by more than 35 tables. When I try to
delete a record from the table, i am getting this message

Msg 431, Level 16, State 0
Unable to bind foreign key constraint. Too many tables involved in query.

SQL 6.5 maximum 31 foreign key references. I was wondering is there any way to delete those
records. (i don't want to drop the foreign constraints)

SQL 7.0 supports maximum 63 foreign key references.

Thanks in advance

Moorthy.

View 1 Replies View Related

Is There A Way To Update Multiple Fields Using UPDATE Command

Oct 19, 2005

UPDATE #TempTableESR SET CTRLBudEng = (SELECT SUM(Salaries) from ProjectBudget WHERE Project = @Project)UPDATE #TempTableESR SET CTRLBudTravel = (SELECT SUM(Travels) from ProjectBudget WHERE Project = @Project)UPDATE #TempTableESR SET CTRLBudMaterials = (SELECT SUM(Materials) from ProjectBudget WHERE Project = @Project)UPDATE #TempTableESR SET CTRLBudOther = (SELECT SUM(Others) from ProjectBudget WHERE Project = @Project)UPDATE #TempTableESR SET CTRLBudContingency = (SELECT SUM(Contingency) from ProjectBudget WHERE Project = @Project)above is the UPDATE command i am using in one of my stored procedures. I have to SELECT from my ProjectBudget table 5 times to update my #TempTableESR table. is there an UPDATE command i can use which would let me update multiple fields in a table using one SELECT command?

View 1 Replies View Related

Job Password Not Accepted.

Oct 25, 2007

I have been trying to open a job properties and then step where its executing sql server 2005 integration services package and when I try to look at the configuration of that package in the job step properties window it asks for the password used to secure the package configuration and even on entering right password its not accpted. Is it a bug or what?

View 2 Replies View Related

Runtime Sqldatasource Delete Command

Aug 12, 2006

i need to dyanamically generate my SQL commands so to do that i am generating sqldatasource commands programmatically rather declaratively. SELECT commands seems to work fine but DELETE isnt doing anything, here is my code:
 
SqlDataSource sdsConsultant = new SqlDataSource();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
loadDataSet();  //it just loads dataset used by formview
initializeSDS();
}


}
protected void initializeSDS()
{
string strConnection = ConfigurationManager.ConnectionStrings["myDB"].ToString();
sdsConsultant.ConnectionString = strConnection;

//SELECT
sdsConsultant.SelectCommand = "SELECT * FROM Consultants WHERE (id=@id)";
QueryStringParameter id = new QueryStringParameter("id", "id");
sdsConsultant.SelectParameters.Add(id);

//DELETE
sdsConsultant.DeleteCommand = "DELETE * FROM Consultants WHERE (id=@id2)";
QueryStringParameter id2 = new QueryStringParameter("id2", "id");
sdsConsultant.DeleteParameters.Add(id2);

//UPDATE
Page.Controls.Add(sdsConsultant);
FormView1.DataSource = sdsConsultant;
FormView1.DataBind();
}
 
my formview control looks like:
<asp:FormView DefaultMode="Edit" ID="FormView1" runat="server" DataKeyNames="id"
OnItemDeleted="FormView1_ItemDeleted"
OnItemDeleting="FormView1_ItemDeleting">
 
the DELETE doesnt execute and the OnItemDeleted event doesnt do anything either. am i doing something wrong here? plz help
 

View 2 Replies View Related

Tablediff Utility Without 'delete' Command.

Apr 23, 2008



I am presently using 'tablediff' utility of SQLServer 2005 to compare tables located on two different servers. My real intension is to backup data from Serv1 to Serv2, except that I wish to update the tables on server2 with only newly inserted rows and updated rows and NOT deleted rows.

In short, I want the final .sql file generated by the tablediff utility to contain only 'Insert' and 'Update' statements and NOT 'Delete' statements.

I hope someone can help me in this regard.

Thank you,
Little_Birdie.

View 6 Replies View Related

SSIS: Fpreach Loop Container- Execute SQL Task With ReturnValue Parameter

Jun 9, 2006

Here's the set up:



ForEach Loop Container:

Collection: Foreach File Enumerator

Variable Mappings: Variable = User::DailyFile, Index = 0



Execute SQL Taks:

Connection: OLEDB

ResultSet: None

SQLStatement: EXEC spGetFile ?

ParameterMapping: VariableName = USER::DailyFile, Direction = Input, DataType=VARCHAR, Parameter = 0

This works great it iterates through a file and looks at all the files checks to see if they have been loaded into the db table, if not it loads the file.

My spGetFile has RETURN 1 if a file is loaded and RETURN 0 if the file is not loaded.

Now I add a new variable:

Step 1: add to Foreach Loop Container

ForEach Loop Container Name = Return, Scope = ForEachLoop, Data Type= Int32 Value=0

Step 2: Add to Execute SQL Task:

VariableName = User:Return, Direction = ReturnValue, DataType = Long, ParameterName =1

This produces the following error:

~~"Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.~~

I tried with an ADO.Net connection ... works until I add the ReturnValue parameter ...



Any ideas??

Thanks





View 4 Replies View Related

Performance Testing Accepted Value

Mar 4, 2008





Measurement min ave max
% Disk Time (PhysicalDisk _Total): 0.053 1.863 63.109
% Processor Time (Processor _Total): 0.0 37.543 98.84
Average Latch Wait Time (ms) (SQLServer|Latches): 0.0 1.537 16
Average Wait Time (ms) (SQLServer|Locks _Total): 0.0 0.193 16
Current Disk Queue Length (PhysicalDisk _Total): 0.0 0.365 67
Log Growths (SQLServer|Databases _Total): 0.0 0.0 0.0
Page Faults/sec (Memory): 9.206 172.064 8612.257
Pages/sec (Memory): 0.0 7.313 815.411
Pool Nonpaged Bytes (Memory): 38195200 38352765.277 38547456
Private Bytes (Process _Total): 1516933120 1663239600.632 1785290752
Processor Queue Length (System): 0.0 0.489 17
Threads (Objects): 922 938.353 950



can anyone tell me what is the accepted value for performance on sql server 2005
this report is generated from mercury load runner

View 1 Replies View Related

Service Account Details Not Accepted

Aug 8, 2015

just trying to run the install and cant get passed the service account page as unsure of the details.

im using the Clustered Instance lab/guide where it says that the account details are as follows:

SQL2K8WKSSQL2K8R2SVC for database agent
SQL2K8WKSSQLAgent2K8R2SVC for agent

but get errors when use these.

View 3 Replies View Related

Get @@rowcount Data From MSSQL Using SqlDataSource With Delete Command

Mar 8, 2007

HiI'm using a simple SqlDataSource to connect to a stored proc to delete a number of rows from different tables.In my SQL im using: DECLARE @table1Count int

DELETE FROM Table1 WHERE id = @new_id

SET @table1Count=@@rowcount

SELECT @table1Count  I'm then using an input box and linking it to the delete control parameter.  Then on a button click event i'm running SqlDataSource1.Delete() which all works fine.  But how do i get the @table1Count back into my aspx page? Thanks 

View 3 Replies View Related

Manually Defined Delete Command Doesn't Work

Feb 16, 2008

Hi,
 i defined a sqldatasource in VWD manually (option specify sql statement) because several tables are involved. I also need a Delete statement, so i defined it also manually.
The select and delete statement are :
 <asp:SqlDataSource ID="SqlDataSource1" runat="server"            ConnectionString="<%$ ConnectionStrings:test %>"                       SelectCommand="SELECT aspnet_Users.UserName as lid, aspnet_Roles.RoleName            as categorie, aspnet_Users.beheerder as beheerder, aspnet_Membership.Email as emailadres FROM aspnet_Users INNER JOIN            aspnet_Membership ON aspnet_Users.UserId = aspnet_Membership.UserId INNER JOIN            aspnet_UsersInRoles ON aspnet_Users.UserId = aspnet_UsersInRoles.UserId inner JOIN            aspnet_Roles ON aspnet_UsersInRoles.RoleId = aspnet_Roles.RoleId order by username"
           DeleteCommand="delete from aspnet_users where userid=@userid">            <DeleteParameters>                <asp:Parameter Name="userid" />            </DeleteParameters>       </asp:SqlDataSource>
My problem is that the Select works, but not the Delete.
Any idea why?
Thanks
tartuffe

View 2 Replies View Related

Master Data Services :: How To Use FORFILES Command To Delete Server Backups

Sep 19, 2015

Recently I constructed a new backup process that I want to institute globally across all my SQL Server 2005 instances, Is there a way I can automate a file deletion process from within SQL Server?

View 2 Replies View Related

Accepted Practice To Query The Built-in Aspnet Membership Tables ?

Jul 17, 2007

I'm a relative newbie to ASP.NET development (web development in general) so please forgive the ignorance. ;-)
Ok, I'm using VWD to design and test my application and I'm using the standard membership provider system.  I've read in various places not to muck around with the aspnet_* tables as it can cause havoc hehe.  Therefore, I've created my own Member table to accommodate more fields that the aspnet_Users table does not have (since I don't want to mess around with that table) such as address, city, town, zip, birth date, etc.  Obviously, I have a field in Member that corresponds to the userId primary key in aspnet_Users.  Now, there are times when I need to display the username of a person's profile on a page.
SELECT aspnet_Users.UserName<br>FROM aspnet_Users, Member<br>WHERE querystringid=Member.memberId AND Member.userId = aspnet_Users.UserId
Now, this seems fine and dandy when there are few entries in the aspnet_Users table, but what if I tried that query when aspnet_Users grew to a hypothetical one million entries??  Does anyone know if those fields in aspnet_Users are properly indexed?  I can't seem to determine one way or another with VWD's database explorer.  I don't want to run the risk of a full table scan.  But if those fields aren't indexed, I don't know if I should modify that table in any way.
What to do?
TIA

View 4 Replies View Related

SQL Server 2014 :: List Of Institutes More Than Half Of Accepted Applicants?

Jan 28, 2015

I have 2 tables:

tbl1: InstituteID, name
tbl2 ApplicantID, InstituteID ,Applicant_Name, address, city, state, status *

* Status field contains value A for acceptance or R for rejected

listing Institute names where more than half of applicants were accepted.

View 2 Replies View Related

Update Command Does Nothing

Aug 10, 2006

I have a database on a server that im trying to update using asp.net.  I tested this on another server and everything worked perfectly.  The test system was set up where the website is hosted.  But the live system is placed on a different server than the webpage.  Does that make a difference? 
Test System
Client -> Website/database
Live System:
Client -> website -> database
I created a user account to use when accessing the database on the live system because i read the double hop causes problems.  By using that account i can access and view the data.  But whenever i update it nothing happens.  NO ERROR either.  It works perfectly but does nothing.  Anyone have any ideas please?!?!?!

View 2 Replies View Related

Update SQL Command

Dec 10, 2007

Hi all, just need a LITTLE help here.  I am very close, I know I am, but just can't seem to fit the last piece in on this.  I have a page that shows current data for a customer and allows you to make changes to the data, then I have a button to push to update the system.  If I hard-code in a value in place of '@Pf_Value' it will update that value, so I know my where is working, just SOMETHING missing in syntax on the set statement or something wrong on my cmd.parameters statement.  Any help would be great!!Protected Sub UpdateButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UpdateButton.Click
Dim sql As String = "update CustomerPOFlexField set [Pf_Value] = @Pf_Value where Pf_property = 'Attrib1' and Pf_CustomerNo = @CustomerNo"Dim newc As String = NewCustomer.Text
Using conn As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("HCISDataConnectionString").ConnectionString)Dim cmd As New SqlCommand(sql, conn)
cmd.Parameters.AddWithValue("@CustomerNo", DropDownlist1.SelectedValue)cmd.Parameters.Add(New SqlParameter("@Pf_Value", TextBox2.Text))
conn.Open()
cmd.ExecuteNonQuery()
End Using
End Sub
Thanks,
Randy

View 16 Replies View Related

SQL Update Command

Jan 8, 2008

Hi all,
Im working in VB web application.Im having some values in some textbox and trying to update it using update command and its not working for me... I used ExecuteNonQuery statement after that. The alert message after that is working for me. But the values i changed in textbox in not updating in my database.
What could be wrong?          cid = lbcid.Text
cname = txtname.Text
contactname = txtconame.Text
tele = Val(txttele.Text)
mob = Val(txtmob.Text)
email = txtemail.Text
genmess = txtgen.Text cmd = New SqlCommand("Update CompanyDetails set CompanyName='" & cname & "',ContactName='" & contactname & "',Telephone=" & tele & ",Mobile=" & mob & ",Generalmess='" & genmess & "',Email='" & email & "'where CompanyId= '" & cid & "'", con)


con.Open()
cmd.ExecuteNonQuery()
Response.Write("<script>alert('Updated')</script>")
 

View 5 Replies View Related

Update Command Help

Nov 5, 2007

I'm using SQL Server Management Studio to do an extremely simple table update (I thought). I wish to fill a newly added table field with a value, however I didn't do this before... What I do is:


UPDATE _t_Computerhuys_MSCRM.dbo.ContactExtensionBase

SET New_Test = "Testvalue"


However then I get the errormessage:

Msg 207, Level 16, State 1, Line 2

Invalid column name 'Testvalue'.


Apparently what I see as a value is being looked at as a column name. I guess it has to do with syntax, but I can't find what's wrong. How to solve?

View 1 Replies View Related

Sql Update With Command.Parameters

Oct 10, 2006

 Im looking for example code to make a sql update... I want to use command.Parameters and variables from text boxes and i'm unsure how to do this...  Please help. This code below doesn't work but it is an example of what i've been working with..  <code>     {               string conn = string.Empty;            ConnectionStringsSection connectionStringsSection = WebConfigurationManager.GetSection("connectionStrings") as ConnectionStringsSection;            if (connectionStringsSection != null)            {                ConnectionStringSettingsCollection connectStrings = connectionStringsSection.ConnectionStrings;                ConnectionStringSettings connString = connectStrings["whowantsConnectionString"];                conn = connString.ConnectionString;                using (SqlConnection connection = new SqlConnection(conn))                using (SqlCommand command = new SqlCommand("UPDATE users SET currentscore=5)", connection))                {                    updateCommand.Parameters.Add("@currentscore", SQLServerDbType.numeric, 18, "currentscore");                    connection.Open();                    command.ExecuteNonQuery();                    connection.Close();                }            }        }</code>   

View 3 Replies View Related

UPDATE Command Not Working

Feb 13, 2007

i am using visual web developer 2005 and SQL Express 2005 and VB as the code behindi have a table called orderdetail and i want to update the fromdesignstatus field from 0 to 1 in one of the rows containing order_id = 2so i am using the following coding in button click event  Protected Sub updatebutton_Click(ByVal sender As Object, ByVal e As System.EventArgs)        Dim update As New SqlDataSource()        update.ConnectionString = ConfigurationManager.ConnectionStrings("DatabaseConnectionString").ToString()        update.UpdateCommandType = SqlDataSourceCommandType.Text        update.UpdateCommand = "UPDATE orderdetail SET fromdesignstatus = '1' WHERE order_id = '2'"  End Sub  but the field is not updatedi do not know where i have gone wrong in my coding. i am sure that my database connection string is correctplease help me 

View 1 Replies View Related

Question Regarding Using The Sql Update Command.

Jul 10, 2007

Here I have the following command
Dim dtNow As DateTime = DateTime.NowSqlDataSource1.UpdateCommand="Update [db] Set [LW]='TRUE', LWD=dtnow Where [PK]=@PK"What I was ttrying to accomplish was , in my grid view, when someone clicks update, it would automatically set LW to true and set LWD to today's date. No user intervention required. However, I figured the above script would not work. What would I have to do to make LWD = dtnow? I do not want to give the user the option to update anything.
 

View 3 Replies View Related

Help With Booleans With UPDATE Command.

Jul 26, 2007

Hello, I'm using a Gridview to display a list of servers.  Each server has a column in a table called "Enabled."  I want to create a button that is supposed to toggle the value called "Enabled."  I am able to make the button either to set Enabled to true or false, but I don't know how to make it toggle.  Here is the command:UpdateCommand="UPDATE [ServerStatus] SET [Enabled] = 1 WHERE [ServerName] = @ServerName" The button is a buttonfield in the gridview:<asp:ButtonField ButtonType="Button" CommandName="Update" HeaderText="Toggle" ShowHeader="True" Text="Toggle" /> Does anyone know the syntax, or a way to make the button set Enabled to true when it is false, and false when it is set to true? 

View 2 Replies View Related

Problem With Update Command

Aug 2, 2007

Hi,i try to update field 'name' (nvarchar(5) in sql server) of table 'mytable'.This happens in event DetailsView1_ItemUpdating with my own code.It works without parameters (i know, bad way) like this:SqlDataSource1.UpdateCommand = "UPDATE mytable set name= '" & na & "'"But when using parameters like here below, i get the error:"Input string was not in a correct format"Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles DetailsView1.ItemUpdatingSqlDataSource1.UpdateCommand = "UPDATE mytable set name= @myname"SqlDataSource1.UpdateParameters.Add("@myname", SqlDbType.NVarChar, na)SqlDataSource1.Update()End SubI don't see what's wrong here.Thanks for helpTartuffe

View 2 Replies View Related

How To Use Update Command At Sqldatasouce

Sep 24, 2007

 hello all..,i have problem in update sqldatasource,  my code like that:me.sqldatasource.updateparameter(index).defaultvalue=valueme.sqldatasource.update()it can not update data, why?but if i use insert or delete like:me.sqldatasource.insertparameter(index).defaultvalue=valueme.sqldatasource.insert()me.sqldatasource.deleteparameter(index).defaultvalue=valueme.sqldatasource.delete()it can work for insert and delete data...can anyone give me update command code in sqldatasouce? plsss...thx...  

View 11 Replies View Related







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