Solved

Need help with an insert statement

Posted on 2009-07-15
5
168 Views
Last Modified: 2012-05-07
I am in need of some help with an insert statement that I have in my asp.net application.  In my SQLDATA Source I have the following in my Insert area...Below is my code.  What I want to do is the following but it doesn't appear to work.  Does anybody have a clue as to how I can fix this?  Thanks!

Insert Into [dbo].MemberFamilyInfo (MemberFamilyNumber, Allergies, Weight, Age, DateOfBirth, MemberFamilyCreatedDate, MemberFamilyCreatedBy) VALUES (@MemberFamilyNumber, @Allergies, @Weight, @Age,@DateOfBirth, @MemberFamilyCreatedDate,  @MemberFamilyCreatedBy) Where EmployeeID = @EmployeeID
0
Comment
Question by:VBBRett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Aaronroach
ID: 24862115
Why do you have a where clause on you insert statement?
0
 
LVL 15

Expert Comment

by:jinal
ID: 24862235
You have to insert record or update record ?
0
 

Author Comment

by:VBBRett
ID: 24869537
Aaron, I am trying to insert a a statement with the EmployeeID being the value of the session object.  Is there a way I can do that?
0
 
LVL 15

Accepted Solution

by:
jinal earned 500 total points
ID: 24869585
now use that insertstatement string in CommandText property.

/* C# */
 
string insertstatement = String.Format("Insert Into [dbo].MemberFamilyInfo (EmployeeID,MemberFamilyNumber, Allergies, Weight, Age, DateOfBirth, MemberFamilyCreatedDate, MemberFamilyCreatedBy) VALUES (@EmployeeID,@MemberFamilyNumber, @Allergies, @Weight, @Age,@DateOfBirth, @MemberFamilyCreatedDate,  @MemberFamilyCreatedBy)", Session["EmployeeID"].ToString());
 
/* VB.net */
 
Dim insertstatement  as String = String.Format("Insert Into [dbo].MemberFamilyInfo (EmployeeID,MemberFamilyNumber, Allergies, Weight, Age, DateOfBirth, MemberFamilyCreatedDate, MemberFamilyCreatedBy) VALUES (@EmployeeID,@MemberFamilyNumber, @Allergies, @Weight, @Age,@DateOfBirth, @MemberFamilyCreatedDate,  @MemberFamilyCreatedBy)", Session["EmployeeID"].ToString());

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question