CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Insert Multiple Records If Selected With a Checkbox

Print topic Send  topic

Author Message
Deb
Posted: 10/05/2004, 2:15 PM

ASP.Net VB Access db

I have an Order Form on an editable grid that I list items from an item table. The user checks the items they need to order and the Order Detail table should be updated. I am using custom insert to insert the records into the OrderDetail table and have tried to use the CMDExecution to insert only the checked rows. I receive an error message when building (I have a support request in but haven't heard back from the engineers).

C:\DOCUME~1\default\LOCALS~1\Temp\~HDSNet\components\PatientNewOrderFormDataProvider.vb(800) : error BC30451: Name 'CmdExecution' is not declared.
CmdExecution = True

My code in "BeforeExecuteInsert" is

If Item.SelectedForOrder.Value = True Then
CmdExecution = True
End If

Is there something I am doing wrong? Also I have the latest version of CodeCharge. Does anyone know of a better way to do this?
Thank you for your help!
Deb
Posted: 10/07/2004, 8:06 AM

This can't be this hard!!!! Help!!:-(

I'm using ASP.Net VB Access DB soon to Sql

I got my error message resolved by support. But I am not able to insert records into the table. What I have is an order form listing items from one table and if the item is checked insert the record into the Order Detail table. I can't use a checkbox list because I need additional fields like quantity, price.

When I leave just the insert option on the editble grid then I receive "no records", if I have the update option then it tries to update and there are no existing records.

Any ideas or suggestions would be greatly appreciated!!!
Deb
Posted: 10/11/2004, 10:52 AM

A continuation of my problem, hoping that someone will offer possible solutions!!!

Since I am retrieving records from one table and trying to insert selected records into another table, CodeCharge is ignoring my custom insert and is only updating. So I have added the following code to "ExecuteAfterInsert" with hopes of getting the records inserted but it is not working.

'EditableGrid qryHOSPatOrderItems Event AfterExecuteInsert. Action Custom Code @321-73254650
' -------------------------
Dim Request As HttpRequest = HttpContext.Current.Request
Dim NewDao As DataAccessObject = Settings.HDSDataAccessObject

if Item.SelectedForOrder.Value = True Then
Dim Sql As String = "INSERT INTO OrderDetail (Qty, InvItem, OrderNo, OrderDetNo,PatientID) " & _
"VALUES ("& NewDao.ToSql(Request.QueryString("qty"),FieldType._Integer) &","& _
NewDao.ToSql(Request.QueryString("InvItem"),FieldType._Integer) &","& _
NewDao.ToSql(Request.QueryString("OrderNo"),FieldType._Integer) &","& _
NewDao.ToSql(Request.QueryString("OrderDetNo"),FieldType._Integer) &","& _
NewDao.ToSql(Request.QueryString("PatientID"),FieldType._Integer) &")"
NewDao.RunSql(Sql)

End If
' -------------------------
' -------------------------
'End EditableGrid qryHOSPatOrderItems Event AfterExecuteInsert. Action Custom Code

I have also tried it in "AfterExecuteUpdate" but I receive an error message that Index or Primary Key cannot be null.

Any suggestions or help is greatly appreciated!!!
Tuong Do
Posted: 10/19/2004, 4:53 PM

Hi Deb
First, there is no insert process (only update) so putting your code in
after execute Insert won't work

And it looks like that Request.QueryString("PatientID") is nothing
Put your code in the before built update

<code>
CmdExecution = false ' To make no update
Dim Request As HttpRequest = HttpContext.Current.Request
Dim NewDao As DataAccessObject = Settings.HDSDataAccessObject
' if Item.SelectedForOrder.Value = True Then
' Inserting every row for testing
Dim Sql As String = "INSERT INTO OrderDetail (Qty, InvItem, OrderNo,
OrderDetNo, PatientID) "
Sql = sql & " VALUES (1,1,3,4,5)"
NewDao.RunSql(Sql)
'End if
</code>

If the above code work then it check your Request.Querystring spelling


"Deb" <Deb@forum.codecharge> wrote in message
news:8416ac869400ee@news.codecharge.com...
>A continuation of my problem, hoping that someone will offer possible
> solutions!!!
>
> Since I am retrieving records from one table and trying to insert selected
> records into another table, CodeCharge is ignoring my custom insert and is
> only
> updating. So I have added the following code to "ExecuteAfterInsert" with
> hopes
> of getting the records inserted but it is not working.
>
> 'EditableGrid qryHOSPatOrderItems Event AfterExecuteInsert. Action Custom
> Code
> @321-73254650
> ' -------------------------
> Dim Request As HttpRequest = HttpContext.Current.Request
> Dim NewDao As DataAccessObject = Settings.HDSDataAccessObject
>
> if Item.SelectedForOrder.Value = True Then
> Dim Sql As String = "INSERT INTO OrderDetail (Qty, InvItem, OrderNo,
> OrderDetNo,PatientID) " & _
> "VALUES ("&
> NewDao.ToSql(Request.QueryString("qty"),FieldType._Integer) &","& _
>
> NewDao.ToSql(Request.QueryString("InvItem"),FieldType._Integer) &","& _
> NewDao.ToSql(Request.QueryString("OrderNo"),FieldType._Integer) &","& _
> NewDao.ToSql(Request.QueryString("OrderDetNo"),FieldType._Integer) &","&
> _
> NewDao.ToSql(Request.QueryString("PatientID"),FieldType._Integer) &")"
> NewDao.RunSql(Sql)
>
> End If
> ' -------------------------
> ' -------------------------
> 'End EditableGrid qryHOSPatOrderItems Event AfterExecuteInsert. Action
> Custom
> Code
>
> I have also tried it in "AfterExecuteUpdate" but I receive an error
> message
> that Index or Primary Key cannot be null.
>
> Any suggestions or help is greatly appreciated!!!
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.