updateing an informix table
&nbsp(259 Views)
I have an informix table that I need to update an amount in. Thefield is called encumbrance is a type number. In my VWD2005 I am using VB and I have a field called NewEncumbrance as type Double.
Here is what I have so far: Tell me where I am goingwrong.
ExecNonQuery(
ExecNonQuery("UPDATE [gl_main] SET [encumbrance] = "
& NewEncumbrance & " WHERE [account_no] = "
& AccNo)

How to update two tables using code behind/session vars
&nbsp(173 Views)
all, I'm getting farther along but seem to have hit a snag. I am trying to update two tables when user hits submit button via code behind. I have my queries written and I've set the session vars so I can do an update query. The main problem I have
is I am confused on how to do a query from code behind. I used to know but I've forgotten, guess the old don't use it you lose it story is true. Does anyone have a simple example of this Any assistance would be greatly appreciated and

how to update row in excel using OleDB?
&nbsp(293 Views)
I am importing data from excel file. According to the values on each
row, i want to write some statement in the last column. I want to do
this without having to install Office or the Redistributable Primary Interop Assemblies Package.
I saw a similar example
http://davidhayden.com/blog/dave/archive/2006/05/26/2973.aspx saying it can be done using only OleDB, something like :
command.CommandText="Update[Cities$]SetCity=
\"Venice\"WHEREID=1";
command.ExecuteNonQuery();
But this wont work the way i am reading
the spreadsheet. My code is like this ::
string ExelConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};" +
"Mode=ReadWrite;ReadOnly=false;" +
"Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\";",
Server.MapPath("./Uploads/" + excelName));
OleDbDataAdapter ExcelDataAdapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$A8:AZ]", ExelConnectionString);
DataSet objDataSet = new DataSet();
ExcelDataAdapter.Fill(objDataSet, "ExcelTable");
for (int r = 0; r < dataTable.AsEnumerable().Count(); r++)
{
Slab slb = new Slab();
slb.ReceiveDate = dataTable.Rows[r].Field(0);
slb.VesselName = dataTable.Rows[r].Field(1);
slb.Lot = Convert.ToInt16(dataTable.Rows[r].Field(2));
slb.SlabSource = dataTable.Rows[r].Field(3);
slb.CertificateNumber = dataTable.Rows[r].Field(4);
if (DateTime.Compare(DateTime.Now, slb.ReceiveDate)>0)
dataTable.Rows[r].Field(5) = "time travel not possible yet";
// the above line is of course wrong, but i need something like this.
}
The end result would be to read each row in the excel file and output something in the last column.

could not update database from dataset in MS SQL server
&nbsp(271 Views)
I have displayed data from the dataset in the datagrid in windows form, it displays perfectly. Now, what I want is, whatever changes I do in datagrid should be updated in the database. For this, i have written following code, but it is not working and it
doesn't give error too. pls help me.
Friend Shared
Function updateManifest(ByRef ds
As DataSet)
Dim oConn As
New SqlConnection(g_strDBConnectionString)
Dim oCommand
As New SqlCommand
Dim oDataSet As
New DataSet
Try
oConn.Open()
oCommand.Connection = oConn
oCommand.CommandText = "cst_edit_manifest"
oCommand.CommandType = CommandType.StoredProcedure
Dim param1 As
New SqlParameter("@Manifest", SqlDbType.NVarChar, 256,
"Name")
Dim param2
As New SqlParameter("@Change", SqlDbType.Int, 4,
"Bundles Req")
Dim param3 As
New SqlParameter("@RouteID", SqlDbType.NVarChar, 50,
"Route ID")
Dim param4
As New SqlParameter("@ChangeProdID", SqlDbType.Int, 4,
"Product Code")
Dim param5 As
New SqlParameter("@BundleSize", SqlDbType.Int, 4,
"Bundle Size")
oCommand.Parameters.Add(param1)
oCommand.Parameters.Add(param2)
oCommand.Parameters.Add(param3)
oCommand.Parameters.Add(param4)
oCommand.Parameters.Add(param5)
oDataAdapter.UpdateCommand = oCommand
oDataAdapter.Update(ds)
MsgBox("updated Successfully")
Finally
oConn.Close()
oCommand.Dispose()
oDataAdapter.Dispose()
oConn.Dispose()
oDataSet.Dispose()
End Try
End
Function
End Class

Edit insert update Delete cmds
&nbsp(278 Views)
I have and oracle db and I am trying to write Edit insert update Delete cmds. I ma using the ODBC to connect to the database. When i use the data srouce that i drag out in degsin mode i make a select statement using the wizard looks like this
SELECT [CLOCK_ID], [LAST_NAME], [FIRST_NAME], [WORK_PHONE], [HOME_PHONE], [CELL_PHONE], [EMAIL], [PRIMARY_DAY_PHONE], [PRIMARY_NIGHT_PHONE], [BLACKBERRY_NUMBER],
But for some odd resson it does not like the brackets. and i query the db fine.
but update does not work
UPDATE [EMPLOYEES] SET [LAST_NAME] = , [FIRST_NAME] = , [WORK_PHONE] = , [HOME_PHONE] = , [CELL_PHONE] = , [EMAIL] = , [SECONDARY_EMAIL] = , [PRIMARY_DAY_PHONE] = , [PRIMARY_NIGHT_PHONE] = , [BLACKBERRY_NUMBER] = , [ADMIN] = WHERE [CLOCK_ID]
=
INSERT INTO [EMPLOYEES] ([CLOCK_ID], [LAST_NAME], [FIRST_NAME], [WORK_PHONE], [HOME_PHONE], [CELL_PHONE], [EMAIL], [SECONDARY_EMAIL], [PRIMARY_DAY_PHONE], [PRIMARY_NIGHT_PHONE], [BLACKBERRY_NUMBER], [ADMIN]) VALUES (, , , , , , , , , , , )
DELETE FROM [EMPLOYEES] WHERE [CLOCK_ID] =
I have removed the brackets from all but still does not work
Mike

insert update statements
&nbsp(269 Views)
I have a connection to a MySQL database but only have the select statement. Does anybody have a link on how to setup a connection to include the insert, update and delete statements

problem with update query
&nbsp(246 Views)
I am having problems with an update query. I am supposed to update a column in the table but when the update was executed, an error was thrown.
The update query : Update book set description = ' " + bookDesc+ " ' where book_ID = 1;
bookDesc is actually values taken from a textbox. However, the values contains single quotes.
Is there any way to contain the values within "" so that non of the content in the bookDesc affects the actual update
Meaning that the update will become something like Update book set description = ' "" + bookDesc+ "" ' where book_ID = 1; where the 2nd double quote is actually the container for the value.

multiple updates
&nbsp(255 Views)
I want to have a form on my site what will bring up a number of rows of data from the MySQL database including the unique key and a user editable quantity field.
Users will be able to modify mutliple rows on the form before submitting the page back. I have the page working to be able to identify which lines the quantities have been altered on and now need to be able to go back to the DB and update the relevant rows.
For a single row update it is obviously the easy and along the lines of:
UPDATE tablename SET quantitycolumn = 'info from form' WHERE uniquekey = 'hidden info from form'
Where visitors update multiple rows I am uncertain how to most efficiently deal with these.... is there a way of joining the update commands

Illegal Variable Name/Number on table update C#
&nbsp(248 Views)
I am having trouble with updating the contents of a table in Oracle, I believe it is coming from trying to insert values of type Varchar2 as i'm not sure i'm doing it correctly. I have tried with both single and no quotes around the varchar2 values in the
SQL statement and neither work. Anyone have any idea what is wrong here
just a note: i have checked all the values going into the sql statement and they are valid and that should not be the problem.
any help is very appreciated
my code:
public void UpdateSubLevel(ArrayList aList)
{
OracleConnection upd_con = new OracleConnection();
upd_con.ConnectionString = //connectionString
upd_con.Open();
foreach (string[] upd_sub in aList)
{
OracleCommand upd_cmd = upd_con.CreateCommand();
OracleTransaction upd_trans;
upd_trans = upd_con.BeginTransaction(IsolationLevel.ReadCommitted);
upd_cmd.Parameters.Add("ev_ID", OracleDbType.Int32, 8).Value = Convert.ToInt32(upd_sub[0]);
upd_cmd.Parameters.Add("su_Code", OracleDbType.Varchar2, 5).Value = upd_sub[1];
upd_cmd.Parameters.Add("su_Desc", OracleDbType.Varchar2, 50).Value = upd_sub[2];
upd_cmd.CommandText = "UPDATE BC_EVENT_SUBLEVEL SET SUBLEVEL_DESC = ':su_Desc' WHERE SUBLEVEL_CODE = ':su_Code' AND EVENT_ID = :ev_ID";
upd_cmd.ExecuteNonQuery();
upd_trans.Commit();
upd_trans.Dispose();
}
upd_con.Close();
upd_con.Dispose();
}

cannot update or delete!!! - Resolved
&nbsp(318 Views)
I feel like such an idiot because it looks like I must be the ONLY ONE IN THE WORLD having this problem. I'm googled and searched this forum and all over for some answers and I just can't find what I need. someone please please help me, I am losing my mind
here!!
I'm trying to make a page for adding and removing category rows from a mysql database. The database is small, and looks like this:
MaincatID - integer (primary key autoinc)
MaincatName - varchar(100)
MaincatDescription - text
I configured the connection with this string:
DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=myDatabase;USER=myusername;PASSWORD=mypassword;OPTION=3;
and when I configured the dataadapter, it generated the insert and select statements, here's what the insert statement looks like (and it works fine, I can insert!!)
'OdbcInsertCommand1
Me.OdbcInsertCommand1.CommandText = "INSERT INTO maincategories (MaincatName, MaincatDescription) VALUES (, )"
Me.OdbcInsertCommand1.Connection =
Me.connDB
Me.OdbcInsertCommand1.Parameters.Add(New System.Data.Odbc.OdbcParameter("MaincatName", System.Data.Odbc.OdbcType.VarChar, 100, "MaincatName"))
Me.OdbcInsertCommand1.Parameters.Add(New System.Data.Odbc.OdbcParameter("MaincatDescription", System.Data.Odbc.OdbcType.VarChar, 2147483647, "MaincatDescription"))
but wouldn't generate the update or delete statements. I went into the properties and tried to create them myself. here is the code it generated
'OdbcUpdateCommand1
Me.OdbcUpdateCommand1.CommandText = "UPDATE maincategories set MaincatName=, MaincatDescription= WHERE MaincatID="
Me.OdbcUpdateCommand1.Connection =
Me.connDB
Me.OdbcUpdateCommand1.Parameters.Add(New System.Data.Odbc.OdbcParameter("MaincatName", System.Data.Odbc.OdbcType.VarChar, 100, "MaincatName"))
Me.OdbcUpdateCommand1.Parameters.Add(New System.Data.Odbc.OdbcParameter("MaincatDescription", System.Data.Odbc.OdbcType.VarChar, 2147483647, "MaincatDescription"))
Me.OdbcUpdateCommand1.Parameters.Add(New System.Data.Odbc.OdbcParameter("Original_MaincatID", System.Data.Odbc.OdbcType.Int, 0, System.Data.ParameterDirection.Input,
False, CType(0,
Byte), CType(0, Byte), "MaincatID", System.Data.DataRowVersion.Original,
Nothing))
'OdbcDeleteCommand1
Me.OdbcDeleteCommand1.CommandText = "DELETE FROM maincategories WHERE MaincatID="
Me.OdbcDeleteCommand1.Connection =
Me.connDB
Me.OdbcDeleteCommand1.Parameters.Add(New System.Data.Odbc.OdbcParameter("MaincatID", System.Data.Odbc.OdbcType.Int, 0, System.Data.ParameterDirection.Input,
False, CType(0,
Byte), CType(0, Byte), "MaincatID", System.Data.DataRowVersion.Original,
Nothing))
Now here is the code for my update:
'Update changes
Dim updateMainCat As dsCategories.maincategoriesRow = dsCategories.maincategories.Rows.Find(lstMainCat.SelectedValue)
updateMainCat.MaincatName = txtMainCatRename.Text
daMainCategories.Update(dsCategories.maincategories)
lstMainCat.DataBind()
and here is the delete code:
'delete a row
Dim deleteMainCat As dsCategories.maincategoriesRow = dsCategories.maincategories.Rows.Find(lstMainCat.SelectedValue)
dsCategories.maincategories.Rows.Remove(deleteMainCat)
daMaincategories.Update(dsCategories)
lstMainCat.DataBind()
but it doesn't do anything to the data in the database!! I receive no error, nor any indication that it tried to do ANYTHING. I am going out of my mind insane with this thing and I can't find ANY information on what is wrong. somebody, PLEASE help me!!!
-SelArom

How to update CLOB field
&nbsp(175 Views)
one of the field in a table is having CLOB data type. There is big text in that field. Now I want to modify the value of the field (add some line of text in the same value) How to do this

Update the entitiy data model - update wizard (not responding) Sybase database
&nbsp(133 Views)
When trying to build or update (even when adding a single table) the update wizard for the Entity Data Model takes forever to complete.
I'm ok while selecting datasource and it reads the tables/view/procedures with success.
When selecting a table to be updated in the model, the update wizard freezes with (Not Responding). This takes hours to complete, and even on completion, the table has not been added.
I am using VS2010 with service pack 1.
I've also turned on/off the checkboxes "include foreign key columns.." and "Pluralize or singularize generated objects..", but having them on or off does not change the "not responding" situation.

Disclaimer : SolveErrors.com is an independent online IT support service provider company for third party product. The brands, Names, Images, Trademarks, Products & services of third parties mentioned on this website are only for reference and to furnish information. SolveErrors has no affiliation with any of these third-party companies unless such relationship is expressly specified. The services we offer may also be available on the brand owner's website.