Web Forms :: Saving Values In 2 Tables?
Aug 16, 2012
I am having requirement to save Event Details in one table and Event Pass Type Vlaues in another table,I have done similar task forĀ SMS before, where I saved SMS Message in one table and sms sent to n no. of Mobile Numbers.But in this scenario the values which I need to save in another table are three(like Passtype,Quantity and Price), I need to save EventĀ Details in tbl_EventDetails Table and EventPassType details in tbl_PassTypeCategory with specific EventID(foregn key in this table and Primary Key in tbl_EventDetails).
Below are the 2 Sps for SMS(which I created before) and EventDetails which is giving wrong output....
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
[Code].....
View 1 Replies
Similar Messages:
Feb 1, 2011
I am using VS 2005.I have 5 tables depending on their values ,I need to draw a bar chart.
View 1 Replies
Jan 1, 2011
I had to discuss a bit of conceptual problem here. The scenario is like this: A user comes on my my website and creates a new profile. As the new profile is created, I tend to save the result in tow tables in datbase viz.1. profiles 2. profiles_plugins The 'id' in profiles table is self-generated and hence there is no problem in storing the data it in the profiles table But at the same time, this self-generated id in table 1 has to be stored in table 2 (profiles_plugins) in the column profile_id.Data reader cannot fetch the value from table while it is being generated. So, basically the problem is how to fetch this self generated id from table1 to be saved in table 2 at the same time when the user submits his details.
View 3 Replies
Mar 16, 2011
I have some JavaScript that on button click takes a the text from the textarea and places it into a div.
What I would like to do preferably via C# is save that content (somehow) to a textdoc maybe? or straight into the database (unsure as it could contain alot). So unfimilar with JavaScript hence my preference for C but if JavaScript could do the job it would be nice to have the client side run the script.
Atm all I want to do is save the divs somehow then later I will learn how to retrieve them.
The JavaScript I have atm for creating the div:
<script type="text/javascript">
$(function () {
$('button').click(function () {
var x = $('textarea').val();
$('textarea').val('');
$('#test1').append('<div id="test">' + x + '</div>');
return false;
});
});
</script>
which outputs:
<div id="test1">
<div id="test">Write Something....</div>
<div id="test">Write Something....</div>
</div>
As you can see there can be many of the same type but if I could just save that data then i could find a way to load it later!
View 2 Replies
Aug 30, 2010
i am trying to save the values from 3 radiobuttons in my database and i cant get it to work . Please see my code below:
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim smoker As String = "No"
Dim pastsmoker As String = "No"
[code...]
View 19 Replies
Jan 18, 2010
I am having 2 list box in my form. I am adding some values from 1st list box to 2nd one. What i need is i would like to save the data in the list box in sql table.
View 6 Replies
Oct 8, 2010
Is it possible to first add controls (ie. CheckBoxes) to a GridView with AutoGenerateColumns set to true. Then to click a single save button which loops thru the controls in the GridView, gets their values (ie. Checked/Not Checked) and then saves those values to a database?
View 9 Replies
Mar 17, 2010
Is it possible for entering values into dropdown and saving that values to DB?
View 2 Replies
Dec 20, 2010
I am reviewing some web code and I am not exactly sure how ASP.net session state works. If a User object is saved to the session state during login, and User.FirstName and User.LastName is set. If other web pages retrieve the user object from the session and set the FirstName to something else is that persisted on other web pages? Or, do you need to re-add the user object back to the session once it has been modified?
View 3 Replies
Mar 4, 2011
I am getting Resultset from SQL server2005.It contains 4 tables.
Dataset ds=new Dataset();
ds=BLogiclayer1.TestMethod1(a,b,c,d);. This normal Dataset ds contains Resultset. ( I am working with RDLC reports. I added a Typed dataset to my project. I am using Typed Dataset as report dataset.) I want to add normal Dataset all the table values to Typed Dataset table as rows i. e. only one table in Typed dataset.I am trying like below.
//Typed Dataset name that I have added is salesdata.
salesdata sd=new salesdata();
for(int i=0;i<ds.Tables.Count ; i++)[code]....
View 2 Replies
May 15, 2010
I'm having a bit of a problem with this code.
The program gives me a list of checkboxes but a user ID. then u user can change his selection and push the save button (id="btnSaveUserIntersts") and i am trying to save in the hidden textbox all the values of the checkboxes that was choosen.
The problem is that i am getting all the time the same selections that came form the database and not getting the new selection that the user made.
what am i doing wrong here?
[code]...
View 3 Replies
Nov 11, 2010
I am new to sql so please bear with me here.I have two tables, COURSES and RESPONSES which have a common field userID. I am making a grid view which displays each users available courseName from the COURSES table and dateTaken from the RESPONSE table. So I simply wrote the query as:
SELECT c.*, r.*
FROM COURSES c, RESPONSE r
WHERE c.userID = @userID1 and r.userID = @userID1 and r.userResponse = NULL
[code]...
View 2 Replies
Aug 13, 2010
How to insert values in four tables at a time......
These tables are having primary key and foreign keys...
View 3 Replies
Nov 9, 2010
I have two tables.One is registeration table in which we have city,state,country and another is location details table in which we have city(multiple values seperated by commas),state and country also same as city
View 5 Replies
Apr 23, 2010
i have an insert statement, and what i would like to do iswhen the value of table1 is entered, that value enters into table 2, so for example, heres my insert statement
INSERT INTO Cards (Name, Desc, id) VALUES ( @Name, @Desc, @id) INSERT INTO CardTP (NameSet, Desc, id)
Now, what i would like to do is that, i will specify all those individual values myself, BUT, when it now comes to the "id" field, when an id is entered for the "Cards" table, the SAME id should also be entered in the id column of the "CardTP" table. how i could enter the value of one table, into another tables row (having the same value) as i want the Cards and CardsTP table to be related in the id fields.
View 3 Replies
May 29, 2010
I have a form with several DropDownlists and TextBoxes, Each dropdownlist depends on the selection of the previouse one.. and there is a submit button. Once the user clicks on it, information entered by the user is displayed in a GridView and saved as well in the database. The GridView holdes information from two tables I used joining) , but once I click on the Submit button I receive this error: Arithmetic overflow error converting varchar to data type numeric. The statement has been terminated. 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.Data.SqlClient.SqlException: Arithmetic overflow error converting varchar to data type numeric. The statement has been terminated. Source Error:
[Code]....
Imports System.Data.SqlClient
Imports System.Web.Configuration
Partial
Class Members_MembersCalculator
Inherits System.Web.UI.Page
Protected Sub CalculateButton_Click(ByVal sender
As Object,
ByVal e As System.EventArgs)
Handles CalculateButton.Click
Dim objConnection As SqlConnection
Dim objDataCommand As SqlCommand
Dim c_manu, c_model, c_date
As String
Dim sSQL As
String
Dim ConnectionString As
String
Dim c_factor As
Double
Dim c_result
As Double
Dim c_milage As
Double
Dim c_id As
Integer
Dim c_year As
Integer
c_manu = ManDropDownList.Text
c_year = YearDropDownList.Text
c_model = ModelDropDownList.Text
c_milage = MilageTextBox.Text
c_factor = FactorDropDownList.Text
c_id = CarIDDropDownList.Text
c_date = CarDateTextBox.Text
c_result = c_factor * c_milage
ConnectionString = WebConfigurationManager.ConnectionStrings("Carbon_free_ConnectionString").ConnectionString
objConnection = New SqlConnection(ConnectionString)
objConnection.Open()
sSQL = "Insert into car (Manufacture, year, Model, car_factor)" & _
"values('" & c_manu &
" ', ' " & c_year & " ',' " & c_model &
" ', ' " & c_factor &
" ')"
objDataCommand = New SqlCommand(sSQL, objConnection)
objDataCommand.ExecuteNonQuery()
objConnection.Close()
objConnection = New SqlConnection(ConnectionString)
objConnection.Open()
sSQL = "Insert into car_Result (car_id, car_Result_Date, Car_result)" & _
"values('" & c_id &
" ', ' " & c_date & " ',' " & c_result &
" ')"
objDataCommand = New SqlCommand(sSQL, objConnection)
objDataCommand.ExecuteNonQuery()
objConnection.Close()
msgLabel.Text = "Your records have been calculated successfuly, Thank you."
'CarDateTextBox.Text = ""
'MilageTextBox.Text = ""
CarGridSqlDataSource.DataBind()
CarGridView.DataBind()
End Sub
End
Class
View 3 Replies
Mar 9, 2011
how to bind selected values from two tables to gridview data source, that two tables are from two databases. i created a view by using these two.But error is getting with this query,that is invalid object derivdtbl_1.Expr1. how to fix this?
SELECT dbo.Station_Channel.St_id, dbo.Station_Channel.lid, dbo.Station_Channel.Edit, dbo.Station_Channel.lChannelName, dbo.Station_Channel.lShort, dbo.Station_Channel.lPosition, dbo.Station_Channel.lTransformData, dbo.Station_Channel.lUnits, dbo.Station_Channel.lDecimalPts,
dbo.Station_Channel.parameter, dbo.Station_Channel.function_value, derivdtbl_1.Expr1
FROM dbo.Station_Channel CROSS JOIN
(SELECT MAX(Fecha) AS Expr1 FROM MeteoStation.dbo.Datos) AS derivdtbl_1
WHERE (dbo.Station_Channel.Edit = 1)
View 2 Replies
Nov 19, 2010
I have a gridview showing values from two tables accommodation and pic (left join on accommodation). If there is no pic uploaded I want to display the row without the pic. So in the gridview I first check to see if the picid is null, if it is i don't render any 'a href' code , if it's isn't i do.
The problem that i'm having is that instead of the image showing up in the gridview itemtemplate i get
','_blank','toolbar=no,menubar=no'))" >
Here is my .aspx code
SelectCommand="SELECT pic.picid, aspnet_Users.Username, accommodation.location, accommodation.type,accommodation.description, convert(varchar,accommodation.createdate,101) as createdate
View 2 Replies
Feb 4, 2011
Is there a standard method for calculating fixed width values for tables in HTML? Right now, I'm working on formatting tables on a web page to be a fixed width, I have a table that's within another table, when testing the page in IE I notice that the alignment of the colon is off as the second picture below illustrates. My intention is to make sure the colons are properly aligned as they are in Firefox and was just curious if the misalignment was due to the settings in the HTML or if it has more to do with how the browser renders the page.
Firefox:
Internet Explorer:
UPDATE: Sorry for not providing any reference code, here's a snippet of the particular section I'm working with.
<div style="width: 1600px; text-align: center; position: absolute; top: 10%; left: 0%;">
<span id="labelInstructions" style="font-size: xx-large;">PAGE TITLE <br><br></span>
<table style="width: 1000px;" align="Center" border="0">
<tbody>
<tr>
<td style="width: 1000px;"><label for="FileUpload1" style="font-size: x-large;">ENTER: </label><input name="FileUpload1" id="FileUpload1" size="70%" type="file"></td>
</tr>
<tr>
<td style="width: 1000px;"><span id="fileUploadError" style="color: Red; font-size: medium;"><br><br></span></td>
</tr>
<tr>
<td style="width: 1000px;">
<table style="width: 1260px;" border="0">
<tbody>
<tr>
<td style="font-size: x-large; width: 800px;" align="right" valign="top">FILE INSTRUCTIONS:</td>
<td style="font-size: x-large; width: 1800px;" align="left" valign="top">INSTRUCTION 1<br>INSTRUCTION 2<br></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td style="font-size: x-large; width: 800px;" align="right" valign="top">FILE EXAMPLE:</td>
<td style="font-size: x-large; width: 1800px;" align="left" valign="top">EXAMPLE 1<br>EXAMPLE 2<br><br></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
I know it's ugly, just a note, this is an ASP.Net generated webpage and I'm setting the attributes of the HTML elements pro-grammatically from the code behind. I sorta inherited this and my employer wants to keep major changes to a minimum. UPDATE 2: When I adjust the inner table width I can get it to align in IE when set to 1377px. For Firefox, the sweet spot for alignment is 1260px.
View 4 Replies
Jan 4, 2011
I have an C# ASP application I am writing that needs to have the capability to import a generated excel or a comma delineated sheet each day. A clerk will have this job each morning so it doesn't need to be automated. My problem in trying to understand the solution to this is that the 1 sheet contains loan information, including customer information all in the same sheet. I would like to send certain columns to update information in the loan table and send other information to update the customer table. I need it to create relationships when new loans appear in the spreadsheet.
View 1 Replies
Dec 30, 2010
I am using bulk insert concept to export the data from dat file to tables(Two tables). I am using the temporary table for to do the calculation and insertion to two tables. My problem is whenever I selecting the temp table data after the execution of bulk insertion , the order is changing .I need to get the order as it is in file order(csv,dat,txt).
View 5 Replies
Jul 24, 2010
I make use of SMO namaspace to get Table, Function, Procedure names from the DB.
Now I've intended to get the tables [Column] name and the relation (dependency) among the tables. Is this possible?
View 2 Replies
Jun 29, 2010
I am getting int values from the stored procedure. But when i bind this datasource with the gridview i am seeing the values being converted into float. i am using Text='<% # Bind("Quantity") %' I wanna that to be displayed as int, with out zero'seg: let the value be 233, when i bind that its getting displayed as 233.00
View 1 Replies
Dec 31, 2010
I would like to save some data for use after a page postback. Here is an example of what I'd like to do:
Partial Class TestPage
Inherits System.Web.UI.Page
Private _CategoryID As String = ""
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
_CategoryID = "ABC"
Me.ViewState("CategoryID") = _CategoryID
Else
_CategoryID = CType(Me.ViewState("CategoryID"), String)
End If
End Sub
End Class
I've tried both session variables and view state. The page loads fine initially, but on postback I get the following error:
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
What am I doing wrong? How can I save this data for use after postback?
View 7 Replies
Apr 25, 2014
i need to save a timestamp byte[] array between page post backs in asp.net webforms and thought having a global variable in a class would work, but it does not?
View 1 Replies