Click here to Skip to main content
15,888,251 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Error Inserting data - into the database. Pin
samflex6-Mar-17 7:01
samflex6-Mar-17 7:01 
AnswerRe: Error Inserting data - into the database. Pin
F-ES Sitecore7-Mar-17 0:52
professionalF-ES Sitecore7-Mar-17 0:52 
GeneralRe: Error Inserting data - into the database. Pin
samflex8-Mar-17 5:03
samflex8-Mar-17 5:03 
GeneralRe: Error Inserting data - into the database. Pin
F-ES Sitecore8-Mar-17 5:44
professionalF-ES Sitecore8-Mar-17 5:44 
GeneralRe: Error Inserting data - into the database. Pin
samflex8-Mar-17 6:09
samflex8-Mar-17 6:09 
GeneralRe: Error Inserting data - into the database. Pin
F-ES Sitecore8-Mar-17 22:16
professionalF-ES Sitecore8-Mar-17 22:16 
GeneralRe: Error Inserting data - into the database. Pin
Richard Deeming8-Mar-17 7:58
mveRichard Deeming8-Mar-17 7:58 
GeneralRe: Error Inserting data - into the database. Pin
samflex8-Mar-17 8:40
samflex8-Mar-17 8:40 
Hi Richard,

First of all, just to make sure I have all my information out there, this is where I got the code i am currently using.

Add And Delete HTML Table Rows Dynamically Using ASP.NET[^]

I just modified to what it is right now.

No, that is not a typo.

Those are being called with the ajax call like:

PHP
function getAllEmpData() {
    var data = [];
    $('tr.data-contact-personm').each(function () {
        var ename = $(this).find('.employeename01').val();
        var etitle = $(this).find('.employeetitle01').val();
        var email = $(this).find('.employeeemail01').val();
        var alldata = {
            'emplName': ename,
            'emplTitle': etitle,
            'empMail': email
        }
        data.push(alldata);
    });
    console.log(data);
    return data;
}


Then
function getAllEmpData() {
var data = [];
$('tr.data-contact-person').each(function () {

function getAllEmpData() {
var data = [];
$('tr.data-contact-person2').each(function () {

etc.

In other words, any unique Add More button has its own row as in tr.data-contact-person. At least that's how I understand.

As for the error message, sorry it mentions @sname which is the alias for sourcename.

If I run these dynamic rows individually, they work just fine.

First instance, if I run the row that contains employeename, employeetitle and employeeincome, inserts correctly into the database.

Similarly, if I run the row that contains sourcename (@sname), sourceaddress, and sourceincome, it works just fine.

It is when I try to combine them that I get the error.

I suspect that ajax calls would not allow multiple INSERT statements.

As for the stored proc, I have it declared correctly. I wish that was the source of the error that I am having. I would have resolved it by now.

This is the stored proc just so you know:

PHP
CREATE PROCEDURE [dbo].[sprInsertDisclsosures]
@ename varchar(50),
@title varchar(50),
@email varchar(50),
@sname varchar(150),
@saddress varchar(100),
@sincome numeric(18,2)

as 

BEGIN
SET NOCOUNT OFF;
    INSERT INTO EMPLOYEES (employeeName, empTitle, email) Values (@ename,@title,@email);
declare @ID int 
set @ID = SCOPE_IDENTITY()
 if @@rowcount > 0
    INSERT INTO SourceDetails (sourcename,sourceaddress, sourceincome,EmployeeID) Values (@sname, @saddress,@sincome, @ID);         
 END


If I test it from SSMS, it inserts records into Employees table, gets the last inserted ID and inserts into SourceDetails table. So, I don't think there is an issue here.

modified 8-Mar-17 14:51pm.

GeneralRe: Error Inserting data - into the database. Pin
Richard Deeming8-Mar-17 8:50
mveRichard Deeming8-Mar-17 8:50 
GeneralRe: Error Inserting data - into the database. Pin
samflex8-Mar-17 8:55
samflex8-Mar-17 8:55 
GeneralRe: Error Inserting data - into the database. Pin
Richard Deeming8-Mar-17 9:09
mveRichard Deeming8-Mar-17 9:09 
GeneralRe: Error Inserting data - into the database. Pin
samflex8-Mar-17 9:19
samflex8-Mar-17 9:19 
Questioninput string was not in a correct format published site error when recycle working properly Pin
Praveen Kandari3-Mar-17 23:31
Praveen Kandari3-Mar-17 23:31 
AnswerRe: input string was not in a correct format published site error when recycle working properly Pin
Richard MacCutchan3-Mar-17 23:37
mveRichard MacCutchan3-Mar-17 23:37 
GeneralRe: input string was not in a correct format published site error when recycle working properly Pin
Praveen Kandari3-Mar-17 23:39
Praveen Kandari3-Mar-17 23:39 
GeneralRe: input string was not in a correct format published site error when recycle working properly Pin
EcareTechnologies8-Mar-17 20:11
EcareTechnologies8-Mar-17 20:11 
QuestionHow to remove marshaling errors for COM-interop or PInvoke Pin
Member 30804702-Mar-17 23:39
Member 30804702-Mar-17 23:39 
AnswerRe: How to remove marshaling errors for COM-interop or PInvoke Pin
Richard MacCutchan3-Mar-17 1:05
mveRichard MacCutchan3-Mar-17 1:05 
QuestionASP.net ajax image upload Pin
Member 130057291-Mar-17 6:15
Member 130057291-Mar-17 6:15 
AnswerRe: ASP.net ajax image upload Pin
F-ES Sitecore1-Mar-17 23:00
professionalF-ES Sitecore1-Mar-17 23:00 
QuestionHow to avoid kill or wait alert? Pin
Member 1028105628-Feb-17 18:24
Member 1028105628-Feb-17 18:24 
AnswerRe: How to avoid kill or wait alert? Pin
Nathan Minier1-Mar-17 1:11
professionalNathan Minier1-Mar-17 1:11 
AnswerRe: How to avoid kill or wait alert? Pin
F-ES Sitecore1-Mar-17 4:13
professionalF-ES Sitecore1-Mar-17 4:13 
AnswerRe: How to avoid kill or wait alert? Pin
ZurdoDev1-Mar-17 5:18
professionalZurdoDev1-Mar-17 5:18 
QuestionImage not showing in vb.net Pin
Member 876166725-Feb-17 10:51
Member 876166725-Feb-17 10:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.