Asp:Checkbox Addition To Database
May 12, 2008
I have a form set-up and am trying to add multiple items in my checkbox to the database; however, the only thing added to the database is the first item checked. Here is the code and any help will be greatly appreciated. Thank you!:<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConConnectionString %>" InsertCommand="INSERT INTO Consultations(FullName, Email, Business, BusinessInfo, Services, Comments) VALUES (@FullName, @Email, @Business, @BusinessInfo, @Services, @Comments)"
SelectCommand="SELECT Consultations.* FROM Consultations">
<InsertParameters>
<asp:ControlParameter Name="FullName" Type="String" ControlId="fullname" PropertyName="Text" />
<asp:ControlParameter Name="Email" Type="String" ControlId="emailTextBox" PropertyName="Text" />
<asp:ControlParameter Name="Business" Type="String" ControlId="bisDropDownList" PropertyName="SelectedValue" />
<asp:ControlParameter Name="BusinessInfo" Type="String" ControlId="businessTextBox" PropertyName="Text" />
<asp:ControlParameter Name="Services" Type="String" ControlID="checkboxlist" PropertyName="SelectedValue" />
<asp:ControlParameter Name="Comments" Type="String" ControlID="commentsTextBox" PropertyName="Text" />
</InsertParameters>
</asp:SqlDataSource>
View 3 Replies
ADVERTISEMENT
Mar 19, 2008
Hi i am trying to store the checkbox values on my page to the database, but im stuck on what to do. I have the following code already;protected void Btn_Subscribe_Click(object sender, EventArgs e)
{SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["streamConnectionString"].ConnectionString);
string strSQL = "INSERT INTO Newsletter(emailAddress) VALUES (@emailAddress)";SqlCommand Command = new SqlCommand(strSQL, conn);
Command.Parameters.Add("@emailAddress", SqlDbType.VarChar);Command.Parameters["@emailAddress"].Value = txtEmail.Text;
conn.Open();
Command.ExecuteNonQuery();
conn.Close();
}
How do i now insert the values from my checkbox, this is how i am setting the checkbox;public void Page_Load(object sender, EventArgs e)
{ArrayList values;if(!IsPostBack)
{
//Build array of data to bind to checkboxlistvalues = new ArrayList();
values.Add("Sport");values.Add("Gardening");values.Add("technology");
AlertList.DataSource = values;
AlertList.DataBind();
}
If i am going about it the wrong way please let me know, thanks
View 15 Replies
View Related
May 1, 2008
I am trying to insert into a database Checkbox list items, I get good values up till the checkBox List and then it gives me all O's, My fields in my database are bit columns so I need the checkbox list itmes to be converted to this format. This is what i have so far. One thing is I don;t think I am inserting into the correct database columns. bitLOD, bitInjury, bitIllness, bitreferral are the database fileds.Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
'Check for the page ID to make sure not an update page then either insert new data or update existing data.
Dim id As String
Dim LOD As Byte
Dim Injury As Byte
Dim Illness As Byte
Dim Referral As Byte
id = Trim(Request.QueryString("ID"))For Each LItems As ListItem In CheckBoxList1.Items
If LItems.Selected = True ThenSelect Case LItems.ValueCase "1"
LOD = 1Case "2"
Injury = 1Case "3"
Illness = 1Case "4"
Referral = 1
End Select
End If
Next
'Put data into the Database
If id = "" Then
'save data into the database
sql = "INSERT tblSADHealth (intTaskForceID, intUICID, strSSN, dtInjury, strNotes, LOD, Injury, Illness, Referral,) " _
& "VALUES (" & ddlTaskForce.SelectedValue & ", " & DDLUIC.SelectedValue & ", '" & txtSSN.Text & "', '" & txtStatus.Text & "', " _
& "'" & txtDate.Text & "','" & txtNotes.Text & "', " & LOD & ", " & Injury & ", " & Illness & ", " & Referral & ")"
Response.Write(sql)
Response.End()
View 4 Replies
View Related
Jun 4, 2008
Hi,
On my page I am using a wizard control with textboxes to collect data from the visitor.
When they click the finish button - this inserts their data into a Sql database.
On the form is a checkbox.
I dont know what type to use in the database column to accept this and also
how to configure the checkbox on the page so I know if its checked.
Also what would be inserted into the database column "yes" "no" or a numerical value??
Thanks for any advice?
amereto
View 1 Replies
View Related
Dec 11, 2007
Hi,
I'm new to ASP.NET 2.0. I'll like to ask how do one save user input from txtbox, radiobttnlist or checkboxlist into database?
Im implementing a suvrey form here by the way.
-any reference webs,
-any pointers from experts?
Thank you for your time in reading this email
Kayln
View 7 Replies
View Related
Sep 12, 2005
I have been trying to add values to a database and it keeps failing
i have no idea what i am doing wrong please help the code is asp.net
using vb. I have been having serious trouble passing check boxes in
forms from day one both singularly and dynamically from datagrids
if someone could show me some sample code of how to pass these
sort of values into the component and on to the query in this way
i would very much appreciate it.
Fuzzygoth
the error returned is
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:
INSERT statement conflicted with COLUMN FOREIGN KEY constraint
'tblStation_FK00'. The conflict occurred in database 'TealSQL', table
'tblTravelPoint', column 'travelpointID'.
The statement has been terminated.
I have marked the area of the code the error is returned in the colour Violet and with a ##
The code i am using is below
## The aspx page ##
<%@ Page Language="vb" Debug="true" Trace="True"
Inherits="Devotion2Motion.AdminComp"
Src="../CodeBehind/AdminModule.vb" %>
<!-- Binds the ActivityResortInfo.ascx user control to the page -->
<%@ Register TagPrefix="UserContol" TagName="D2MHeader" Src="../UserControls/Header.ascx" %>
<%@ Register TagPrefix="UserContol" TagName="D2MFooter" Src="../UserControls/Footer.ascx" %>
<%@ Register TagPrefix="UserContol" TagName="TravelPointDD" Src="../UserControls/TravelPointDD.ascx" %>
<script language="vb" runat="server">
Sub Page_Load()
If IsPostback = True Then
Dim aInternational As Integer
Dim Station As String = Request.Form("StationFrm")
Dim Type As String = Request.Form("TypeFrm")
Dim Address1 As String = Request.Form("address1Frm")
Dim Address2 As String = Request.Form("address2Frm")
Dim City As String = Request.Form("cityFrm")
Dim International As String = Request.Form("InternationalFrm")
Dim TravelPoint As Integer = Request.Form("_ctl5:dsTravelPointDD")
If IsNothing(International) Then
aInternational = "0"
Else
aInternational = "1"
End If
Dim AdminTravelPoints As New Devotion2Motion.AdminComp()
' Select the country dropdown list
AdminTravelPoints.AddStation(Station, Type, Address1, Address2, City,
aInternational, TravelPoint)
End If
Dim ReadResultTable As New Devotion2Motion.AdminComp()
' Select the country dropdown list
dsResultSet.DataSource = ReadResultTable.GetStationtbl()
dsResultSet.DataBind()
End Sub
</script>
<!-- This UserControl Pulls in the header UserControl and the Div Tag Positions it #css reffrence is TopControl -->
<Div Class="TopControl">
<UserContol:D2MHeader runat="server"/>
</Div>
<form method="post" action="AdminTravelPoint.aspx" runat="server">
<Div Class="CentreControl">
<table border="0">
<tr>
<td>
<asp:Label Text="Station Name: " CssClass="BodyStyle" runat="server"/>
</td>
<td>
<asp:TextBox ID="StationFrm" CssClass="PrimaryGrid" runat="server"/>
</td>
<tr>
<tr>
<td>
<asp:Label Text="Type: " CssClass="BodyStyle" runat="server"/>
</td>
<td>
<asp:TextBox ID="TypeFrm" CssClass="PrimaryGrid" runat="server"/>
</td>
<tr>
<tr>
<td>
<asp:Label Text="Address1: " CssClass="BodyStyle" runat="server"/>
</td>
<td>
<asp:TextBox ID="Address1Frm" CssClass="PrimaryGrid" runat="server"/>
</td>
<tr>
<tr>
<td>
<asp:Label Text="Address2: " CssClass="BodyStyle" runat="server"/>
</td>
<td>
<asp:TextBox ID="Address2Frm" CssClass="PrimaryGrid" runat="server"/>
</td>
<tr>
<tr>
<td>
<asp:Label Text="City: " CssClass="BodyStyle" runat="server"/>
</td>
<td>
<asp:TextBox ID="CityFrm" CssClass="PrimaryGrid" runat="server"/>
</td>
<tr>
<tr>
<td>
<asp:Label Text="International: " CssClass="BodyStyle" runat="server"/>
</td>
<td>
<asp:CheckBox ID="InternationalFrm" CssClass="PrimaryGrid" runat="server"/>
</td>
<tr>
</tr>
<td>
<asp:Label Text="Travel Point: " CssClass="BodyStyle" runat="server"/>
</td>
<td>
<UserContol:TravelPointDD runat="server"/>
</td>
<tr>
</tr>
<td>
</td>
<td>
<input value="Submit" type="submit">
</td>
</tr>
</table>
</Div>
<asp:DataGrid ID="dsResultSet" AutoGenerateColumns="False" CssClass="PrimaryGrid" ShowHeader="true" runat="server">
<Columns>
<asp:BoundColumn DataField="StationID" ReadOnly="true" HeaderText="Station ID"/>
<asp:BoundColumn DataField="Station" ReadOnly="true" HeaderText="Station"/>
<asp:BoundColumn DataField="Type" ReadOnly="true" HeaderText="Type"/>
<asp:BoundColumn DataField="Address1" ReadOnly="true" HeaderText="Address"/>
<asp:BoundColumn DataField="Address2" ReadOnly="true" HeaderText=" "/>
<asp:BoundColumn DataField="City" ReadOnly="true" HeaderText="City"/>
<asp:BoundColumn DataField="International" ReadOnly="true" HeaderText="International"/>
<asp:BoundColumn DataField="TravelPoint" ReadOnly="true" HeaderText="City"/>
</Columns>
</asp:DataGrid>
</form>
<Div Class="CenterControl">
<UserContol:D2MFooter runat="server"/>
</Div>
##the vb componet that passess to the sql query ##
Public Function AddStation(ByVal Station As String, ByVal Type As
String, ByVal Address1 As String, ByVal Address2 As String, ByVal City
As String, ByVal aInternational As Integer, ByVal TravelPoint As
Integer) As SqlDataReader
' Create Instance of Connection and Command Object
Dim
myConnection As New
SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Dim
myCommand As New SqlCommand("sp_call_Station_Insert", myConnection)
' Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure
' Add Parameters to SPROC
Dim
parameterStation As New SqlParameter("@Station", SqlDbType.NVarChar, 50)
parameterStation.Value = Station
myCommand.Parameters.Add(parameterStation)
' Add Parameters to SPROC
Dim
parameterType As New SqlParameter("@Type", SqlDbType.NVarChar, 50)
parameterType.Value = Type
myCommand.Parameters.Add(parameterType)
' Add Parameters to SPROC
Dim
parameterAddress1 As New SqlParameter("@Address1", SqlDbType.NVarChar,
50)
parameterAddress1.Value = Address1
myCommand.Parameters.Add(parameterAddress1)
' Add Parameters to SPROC
Dim
parameterAddress2 As New SqlParameter("@Address2", SqlDbType.NVarChar,
50)
parameterAddress2.Value = Address2
myCommand.Parameters.Add(parameterAddress2)
' Add Parameters to SPROC
Dim
parameterCity As New SqlParameter("@City", SqlDbType.NVarChar, 50)
parameterCity.Value = City
myCommand.Parameters.Add(parameterCity)
' Add Parameters to SPROC
Dim
parameteraInternational As New SqlParameter("@aInternational",
SqlDbType.Int, 4)
parameteraInternational.Value = aInternational
myCommand.Parameters.Add(parameteraInternational)
' Add Parameters to SPROC
Dim
parameterTravelPoint As New SqlParameter("@TravelPoint", SqlDbType.Int,
4)
parameterTravelPoint.Value = TravelPoint
myCommand.Parameters.Add(parameterTravelPoint)
' Execute the command
myConnection.Open()
## Dim result As SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
' Return the datareader
Return result
End Function
## The sql stored procedure ##
CREATE PROCEDURE [dbo].[sp_call_Station_Insert]
(
@Station As nVarChar(50),
@Type As nVarChar(50),
@address1 As nVarChar(50),
@address2 As nVarChar(50),
@City As nVarChar(50),
@aInternational As nVarChar(50),
@TravelPoint As Int
)
AS
DECLARE @ConVale As nVarChar(50)
SET @ConVale = (SELECT Station FROM tblStation WHERE @Station = Station)
If @ConVale = @Station
BEGIN
SELECT * FROM tblStation
END
ELSE
BEGIN
insert into tblStation
(Station, Type, address1, address2, city, International, TravelPoint)
values (@Station, @Type, @address1, @address2, @City, @aInternational, @TravelPoint)
SELECT * FROM tblStation
END
GO
View 1 Replies
View Related
Aug 28, 2007
How can i make a sum (concatenation) of strings of one column in a table.
for example i have a table like this
field1 field2
1 abc
1 bcd
2 sdf
2 sdd
I want to get these strings added group by field 1
Thanks
View 5 Replies
View Related
Jan 24, 2001
For an existing table containing data, how would you add a primary key field, that contains a value for each row?
(Under Access I'd just add a new field and set it to type AutoNumber, but you can't do that in SQL Server)
View 1 Replies
View Related
Jan 15, 2002
Hi Everybody,
I hv executed the following query in the Query Qnalyzer
(Ofcourse I am Using SQL 2000 Enterprise Edition) and Surprisingly
I am getting the Output as follows,
query:-
select '5' + 10
Output:- 15
Can anybody please tell me, why it is happening like this? OR Did I miss any Configuration Parameter in the Server Settings?.
Tks in Advance,
Sam
View 1 Replies
View Related
May 12, 2008
Hi
Is there anyway to perform a addition on two items in a COUNT query?
For example if i use the followig query:
SELECT
Region
,COUNT(*)
FROM Regions
GROUP BY Regions
It would give me the following results:
Region1 22
Region2 33
Region3 21
Region4 4
Region5 9
Region6 61
However I would want it display the the combined totals Region1 and Region2 together so it would give the figure of 55.
Is this possible?
Thanks
View 6 Replies
View Related
Dec 6, 2006
i have the idea that 23+null=null
now following is my case with 2 columns as:
salary bonus
1 null
2 5
3 null
i have to find the total salary(i.e. salary+bonus)
this is how i managed to do it:
select empname,(salary + commission) as 'total salary'
from emp
where commission is not null
union
select empname,salary from emp
where commission is null
now my question is,wht if the case now is different as below:
salary bonus hra
1 null 6
2 5 null
3 null null
now how do i calculate total salary(i.e. salary+bonus+hra)
am a beginner
help appreciated
cheers
View 5 Replies
View Related
Mar 22, 2007
hi guys,
I have got something like this,
A S D
Bi Ar 23
Bi Ar 12
As Ar 52
As Ar 11
Ap Jo 24
I Have 3 columns. First 2 columns are Text and the third one is Number. I need to see if any duplicate values are there in first 2 columns. If so then i need to add the values of 3 columns and make it one. So the output should look like this,
A S D
Bi Ar 35
As Ar 63
Ap Jo 24
View 15 Replies
View Related
Mar 16, 2007
Hi I have a query, what I would like to do is create a column that takes the results in two coulms and add them together:
Col A Col B Col C
Row1 1 1 2
Row2 2 3 5
Here is the query
declare @t table( player_name varchar(100), BuyIn int, TopUp int, ReBuy int, Winnings int, Events int, Test int)
INSERT INTO @t (player_name, TopUp)
SELECT Player_name, SUM([Top-ups]) AS TOPUPS
FROM (SELECT Event_data.Transaction_type, Players.Player_name, Events.Top_up, Event_data.Transaction_value,
Events.Top_up * Event_data.Transaction_value AS [Top-ups]
FROM Event_data INNER JOIN
Events ON Event_data.Event_id = Events.id INNER JOIN
Players ON Event_data.Player_id = Players.Player_id
WHERE (Event_data.Transaction_type = 2)) AS Topups
GROUP BY player_name
INSERT INTO @t (player_name, ReBuy )
SELECT Player_name, SUM([Re-buys]) AS REBUYS
FROM (SELECT Event_data.Transaction_value, Players.Player_name, Events.Rebuys, Event_data.Transaction_value * Events.Rebuys AS [Re-buys]
FROM Event_data INNER JOIN
Events ON Event_data.Event_id = Events.id INNER JOIN
Players ON Event_data.Player_id = Players.Player_id
WHERE (Event_data.Transaction_type = 3)) AS REBUYS
GROUP BY Player_name
Insert into @t (player_name, BuyIn)
SELECT dbo.Players.Player_name, SUM(dbo.Events.Buy_in) AS BuyIn
FROM dbo.Players INNER JOIN
dbo.Event_data ON dbo.Players.Player_id = dbo.Event_data.Player_id INNER JOIN
dbo.Events ON dbo.Event_data.Event_id = dbo.Events.id
GROUP BY dbo.Players.Player_name, dbo.Event_data.Transaction_type
HAVING (dbo.Event_data.Transaction_type = 1)
ORDER BY SUM(dbo.Events.Buy_in) DESC
Insert into @t (player_name, Winnings)
SELECT dbo.Players.Player_name, SUM(dbo.Event_data.Transaction_value) AS Winnings
FROM dbo.Players INNER JOIN
dbo.Event_data ON dbo.Players.Player_id = dbo.Event_data.Player_id
GROUP BY dbo.Players.Player_name, dbo.Event_data.Transaction_type
HAVING (dbo.Event_data.Transaction_type = 1)
insert into @t (player_name, Events)
SELECT dbo.Players.Player_name, COUNT(dbo.Event_data.Place) AS Expr1
FROM dbo.Players INNER JOIN
dbo.Event_data ON dbo.Players.Player_id = dbo.Event_data.Player_id INNER JOIN
dbo.Events ON dbo.Event_data.Event_id = dbo.Events.id
GROUP BY dbo.Players.Player_name
HAVING (NOT (COUNT(dbo.Event_data.Place) IS NULL))
insert into @t (player_name, test)
select player_name, ((TopUp) + (Rebuy)) as Test
from @t
SELECT player_name, min (BuyIn) as BuyIn, min(TopUp) as TopUps, min(ReBuy)as ReBuy, min(Winnings) as Winnings, min(Events) as Events, min(test) as test
FROM @t
GROUP BY player_name
ORDER BY BuyIn DESC
--ORDER BY TOPUPS DESC
END
THis is where I attempt to add the coloms but I get a null result
insert into @t (player_name, test)
select player_name, ((TopUp) + (Rebuy)) as Test
from @t
any help would be great.
View 5 Replies
View Related
Jan 7, 2008
I am trying one of the examples from the .NET Framework 2.0 Web-Based Client Development and I'm having a problem authenticating. I'm running everything on my local computer (IIS, SQL 2005 STANDARD ADDITION and Visual Studio). While in Visual Studio (in other words, debug mode) when I run the example, I get the following error:
Cannot open database "pubs" requested by the login. The login failed.Login failed for user 'DPJ-6E95AFFA416ASPNET'.
This could be more of a SQL question that a ASP.NET question, but I'm not sure. I'm running under the local administrator account, but this seems to indicate that ASP is using it's own credentials to access SQL. This is my first time using these tools, and I'm guessing this is a fairly well know issue.
I was looking for a "User Admin" function in SQL and could not find it, so I'm a bit lost here.
Can anyone help please.
Thanks
View 6 Replies
View Related
Nov 14, 2000
I need to up my license limit on a SQL box from 1 to 2 user connections allowed. Where do I do this?
View 1 Replies
View Related
Dec 1, 2007
Hi,
I have several INT columns in a table that I need to update.
For example, in column 'aa' I need to add 2 to all of the values in that column.
I'm using Query Analyzer - what update statement should I write?
View 3 Replies
View Related
Jun 21, 2008
@quantity is the number that the user has input in the txtbox. I want to use this value to ADD together with the current quantity value in the shopcartitem table. I do not know how, my current query only replaces the old quantity with the new .. can someone help me? strSql = "UPDATE ShopCartItem sci SET sci.Quantity" & _
"WHERE sci.ProductID=@ProductID AND sci.ShopCartID=@ShopCartID"Dim cmd2 As New SqlCommand(strSql, conn)
cmd2.Parameters.AddWithValue("@Quantity", quantity)cmd2.Parameters.AddWithValue("@ProductID", productId)
cmd2.Parameters.AddWithValue("@ShopCartID", ShopCartID)
View 1 Replies
View Related
Dec 10, 2013
I've two databases with different structures, i want to add a record with it's data from the first database into the second database in the place i define, this action must happen automatically as soon as the record is created in the first database.
View 1 Replies
View Related
Nov 8, 2007
Hi,
is there a way to perform an addition to the value of a report parameter?
so like Param Value + 1 = 6
where Param Value would be 5?
View 11 Replies
View Related
Feb 2, 2008
Are there any differences between the Developer Addition and Enterprise Addition of 64 Bit SQL Server 05 that would prevent me from testing full capabilities of my production Enterprise Addition in a QA environment utilizing Developer Addition? Any known restrictions on number of DB connections, memory, CPUs etc??
View 4 Replies
View Related
May 9, 2006
How can I check for Null for the amounts if no records are returned in either select. Basically it errors out if one or both of the Amounts return no records. I need to do some sort of IF statement to set one of the amounts or both amounts to zero in those cases so it doesn't error out on me
SELECT (Coalesce(pd1_Amount, 0) + Coalesce(PD2_Amount, 0)) as Amount
FROM
(
SELECT pd.Amount as pd1_Amount
FROM Master m (NOLOCK)
LEFT JOIN dbo.pdc pd ON pd.number = m.number
INNER JOIN dbo.Customer c ON c.Customer = m.Customer
WHERE pd.Active = 1
AND pd.Entered BETWEEN DATEADD(DAY, -DATEPART(DAY, @FirstDayMonthDate) + 1, @FirstDayMonthDate) AND DATEADD(DAY, -DATEPART(DAY, @FirstDayMonthDate), DATEADD(MONTH, 1, @FirstDayMonthDate))
AND pd.Entered <> '1900-01-01 00:00:00.000'
AND pd.Deposit BETWEEN DATEADD(DAY, -DATEPART(DAY, @FirstDayMonthDate) + 1, @FirstDayMonthDate) AND DATEADD(DAY, -DATEPART(DAY, @FirstDayMonthDate), DATEADD(MONTH, 1, @FirstDayMonthDate))
--AND pd.Deposit IS NOT NULL
--AND pd.OnHold IS NULL
AND c.customer <> '9999999'
UNION
SELECT pdd.Amount as PD2_Amount
FROM Master m (NOLOCK)
LEFT JOIN dbo.pdcdeleted pdd ON pdd.number = m.number
INNER JOIN dbo.Customer c ON c.Customer = m.Customer
WHERE pdd.Entered BETWEEN DATEADD(DAY, -DATEPART(DAY, @FirstDayMonthDate) + 1, @FirstDayMonthDate) AND DATEADD(DAY, -DATEPART(DAY, @FirstDayMonthDate), DATEADD(MONTH, 1, @FirstDayMonthDate))
AND pdd.Entered <> '1900-01-01 00:00:00.000'
AND pdd.Deposit BETWEEN DATEADD(DAY, -DATEPART(DAY, @FirstDayMonthDate) + 1, @FirstDayMonthDate) AND DATEADD(DAY, -DATEPART(DAY, @FirstDayMonthDate), DATEADD(MONTH, 1, @FirstDayMonthDate))
--AND pdd.Deposit IS NOT NULL
--AND pdd.OnHold IS NULL
AND c.customer <> '9999999'
) as PDC_Main
View 3 Replies
View Related
Sep 6, 2007
Hi,
I was wondering if you can help.
In my vb.net form I am running a query to insert data from one database table to another.
However what I need to do is to be able is to add the id of a record I have just created to this insert into sql command.
I have managed to use @@ identity to get the id of my first sql insert statement
but I am wondering how I can use it in the second insert into and select statement. At the moment my sql statement just copies exactly what is in the select statement. I can't figure out how to add the @@identity value to my second sql statement.
My second sql statement is a follows:
sql2 = "INSERT INTO ProjectDeliveData(ProjId,ProjDeliveId,RoleId,MeasurementId,ProjDeliveValue, ProjDeliveComments,ProjDeliveYear,FinDataTypeId, FinFileId, ProjDeliveMonthFrom, ResourceId,ProjDeliveDateAdded)" & " select ProjId,ProjDeliveId,RoleId,MeasurementId,ProjDeliveValue, ProjDeliveComments,ProjDeliveYear,FinDataTypeId, FinFileId, ProjDeliveMonthFrom, ResourceId,ProjDeliveDateAdded from ProjectDeliveData where FinFileId=" & strActualFileId
I hope you can help
Cheers
Mark :)
View 7 Replies
View Related
Nov 29, 2004
Dear all participants,
I manage complete online system for two locations, connected via dialup lease line. I have to used merge replication for the same data should be at both locations. It is working fine, I don’t like disturbe it but current requirement is addition of two column in one table which one as also use in merge replication.
How I can add aforesaid columns in table x, column name c1 numeric , c2 character?
What is impact on replication?
Let me know step by step.
Thanks in advance.
Thanks R.Mall
View 1 Replies
View Related
Jan 22, 2005
Can any help me addition of article in runnning merge replication in MSSQL SERVER 2000 with SP3.
Any step by step help is realy great for me.
Thanks
R.Mall
View 1 Replies
View Related
Apr 3, 2004
SQL Server allows addition of two "datetime" values. For example let d1='April 10,2004' and d2='April 11, 2004'. Now when I execute d1+d2 I get 2108-07-20 00:00:00.000. On what logic is this calculation done.
I am actually looking to derive the same result in Oracle. Hence wanting to know the funda behind this.
many thanks.
View 2 Replies
View Related
Sep 29, 2015
My goal is to be able to include test information in the change request that will make the operations manager confident that the change can proceed. Right now all I can think of is to add the index in dev and staging and compare some before and after stats. But I am concerned that an index change might also affect other operations besides SELECTs - such as updates, transactions, or scheduled jobs.
[URL]
View 0 Replies
View Related
Jun 2, 2004
Hi,
Even this question is not related to this forum but may be some one help me.
I have a master detail form. I want to delete record but only those record that user click with checkbox. There is no field like boolean. How can I make a scenerio about adding an unbound checkbox in detail form and how would i link with rows in detail sub form.
any help will be highly appreciated.
Regards,
View 2 Replies
View Related
May 29, 2015
We are using SSRS 2012. Before we were with 2005. Both the versions have the problem. When a change made to parameters (like adding additional parameter to existing report or changing default value of parameter) using visual studio on developers machine and re-deploy to server, additional parameter or changes to parameter is not showing up. So, we are first deleting the report from server and then re-deploying. This works fine. But we realized that we are losing history of the report (like data related to this report run from execution log). We need the history of report. It is very important to top management to see the details.When I searched in forums, users say that it still exist in 2012 and 2014 and every one talks about deleting and re-deploying report. I would like to know if there is any other alternate route to redeploy additional parameter and not lose history.
View 6 Replies
View Related
Apr 16, 2004
Hi,
I have a dynamical query to select the data from my sql db.
Everything works fine except the checkboxes.
Since the values in the db table are stored in booleans (BIT) field and I am using the a string builder to generate the sql query, I am stucked.
How can I solve this problem?
My stringbuilder works roughly like:
string XRealtime = ckbReal.Checked.ToString();
XRealtime = (XRealtime !="False" ? "Main.Realtimedata = '" + XRealtime + "'": "");
System.Text.StringBuilder query = new System.Text.StringBuilder();
query.Append("SELECT * From Main Where");
...
query.Append(XRealtime);
query.Append((XRealtime !="" ? " AND " : ""));
...
Thank you in advance...
Gorginio
View 1 Replies
View Related
Feb 2, 2006
hello all i have a 2 questions hope that u can help me my first question is: in ms access there was a data type named yes/no and it was a checkbox is there a checkbox data type in sql server 2005?
my second question is i need the connection code between asp.net 2005 and sql server 2005 i searched in here for that code but i got more confuse i found two codes and both are not working so hope u can give me the right connecting code. that's all thanks
View 11 Replies
View Related
Feb 8, 2007
Hi all,
I'm using the NULL checkbox in a report. Is it possible to change the diplayed name 'NULL' in a different name. The user will not see 'NULL' but something else.
Is that possible??
Greetz
View 3 Replies
View Related
Jan 30, 2008
Hi All,
I have a database table with a bit field. In my .aspx page I have a checkbox that is checked by default. My SqlDataSource is set up like so:
InsertCommand="INSERT INTO Studies (Study_Name, Study_Status) VALUES (@StudyName, @StudyStatus)"> <InsertParameters> <asp:ControlParameter ControlID="txtStudyName" Name="StudyName" PropertyName="Text" Type="String"/> <asp:ControlParameter ControlID="chkboxStudyStatus" Name="StudyStatus" PropertyName="Text" Type="Boolean"/>
I'm getting an error when inserting.
Error: Cannot insert the value NULL into column 'Study_Status', table 'Studies'; column does not allow nulls. INSERT fails. The statement has been terminated.
View 2 Replies
View Related
Mar 7, 2008
Hello
I need to make a webpage that stores the name, email, ... from the user into a database. The user also checks several checkboxes to register for some items. That last one gives me some trouble. Inside my code the checkbox-value is stored into a Boolean (true of false). On the sql-server I declared my field as a Bit (0 or 1).
1 public string Input_inschrijving(cls_inschrijving nieuwe_inschrijving) {
2
3
4
5 inschrijving_cn = new SqlConnection("Data Source=serverIp;Persist Security Info=True;User ID=DBname;Password=mypasword");
6
7
8
9 string stUser = "INSERT INTO tbl_inschrijving (naam, voornaam, straat, nr, postcode, woonplaats, telefoon, email, functie, organisatie, ostraat, onr, opostcode, owoonplaats, otelefoon, oemail, ws1, ws2, ws3, ws4, ws5, ws6, ws7, ws8, ws9, ws10, ws11, ws12) VALUES ('" + m_naam + "', '" + m_voornaam + "', '" + m_straat + "', '" + m_nr + "', '" + m_postcode + "', '" + m_woonplaats + "', '" + m_telefoon + "', '" + m_email + "', '" + m_functie + "', '" + m_organisatie + "', '" + m_ostraat + "', '" + m_onr + "', '" + m_opostcode + "', '" + m_owoonplaats + "', '" + m_otelefoon + "', '" + m_oemail + "', " + m_ws1 + " , " + m_ws2 + " , " + m_ws3 + " , " + m_ws4 + " , " + m_ws5 + " , " + m_ws6 + " , " + m_ws7 + " , " + m_ws8 + " , " + m_ws9 + " , " + m_ws10 + " , " + m_ws11 + " , " + m_ws12 + ")";
10
11
12
13 cm = new SqlCommand(stUser, inschrijving_cn);
14
15
16
17 try
18
19 {
20
21 inschrijving_cn.Open();
22
23 dr = cm.ExecuteReader();
24
25 dr.Close();
26
27 inschrijving_cn.Close();
28
29 return "Your registration was succesfull!";
30
31
32
33 }
34
35 catch(SqlException sx) {
36
37 return "Error!" + sx.Message;
38
39 }
40
41 }
42
Inside the table tbl_inschrijving on the SQL-server, i declared the checkbox values ws1, ws2, ws3, ... to a bit with length 1 (nulls allowed)How can I store the boolean-value into my table? I tried to change several declarations (int, char, varchar...) nothing works.
View 3 Replies
View Related