Using Checkbox To Save To Bit Field

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


ADVERTISEMENT

!!help!! How To Save User Inputs From Checkbox List To Database??

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

Checkbox - Using In Update Statement As Bit Field

Jul 24, 2006

hi I have a bit field in sql server represented by a checkbox ... I am updating the database in code ( ie not using formview generated update .. ) the line that is falling over is .Parameters.Add("@archive", SqlDbType.Bit).Value = txtarchive.Checkedit falls over saying failed to convert string parameter to boolean the
value of txtarchive.checked is either true or false - how do i convert
this to 1 or 0 or something that sql is happy with ... thanks

View 2 Replies View Related

Inserting A Checkbox Value Into Bit Field Sql Server 2000

Dec 17, 2004

Edited by SomeNewKid. Please post code between <code> and </code> tags.


This is probaly the easiest question you've ever read but here goes.

I have a simple checkbox value that i want to insert into the database but whatever i do it does not seem to let me.

Here is my code:

Sub AddSection_Click(Sender As Object, e As EventArgs)
Dim myCommand As SqlCommand
Dim insertCmd As String
' Build a SQL INSERT statement string for all the input-form
' field values.
insertCmd = "insert into Customers values (@SectionName, @SectionLink, @Title, @NewWindow, @LatestNews, @Partners, @Support);"
' Initialize the SqlCommand with the new SQL string.
myCommand = New SqlCommand(insertCmd, myConnection)
' Create new parameters for the SqlCommand object and
' initialize them to the input-form field values.
myCommand.Parameters.Add(New SqlParameter("@SectionName", SqlDbType.nVarChar, 50))
myCommand.Parameters("@SectionName").Value = Section_name.Value

myCommand.Parameters.Add(New SqlParameter("@SectionLink", SqlDbType.nVarChar, 80))
myCommand.Parameters("@SectionLink").Value = Section_link.Value

myCommand.Parameters.Add(New SqlParameter("@Title", SqlDbType.nVarChar, 50))
myCommand.Parameters("@Title").Value = Section_title.Value

If New_window.Checked = false Then
myCommand.Parameters.Add(New SqlParameter("@NewWindow", SqlDbType.bit, 1))
myCommand.Parameters("@NewWindow").Value = 0
else
myCommand.Parameters.Add(New SqlParameter("@NewWindow", SqlDbType.bit, 1))
myCommand.Parameters("@NewWindow").Value = 1
End If

If Latest_news.Checked = false Then
myCommand.Parameters.Add(New SqlParameter("@LatestNews", SqlDbType.bit, 1))
myCommand.Parameters("@LatestNews").Value = 0
else
myCommand.Parameters.Add(New SqlParameter("@LatestNews", SqlDbType.bit, 1))
myCommand.Parameters("@LatestNews").Value = 1
End If

If Partners.Checked = false Then
myCommand.Parameters.Add(New SqlParameter("@Partners", SqlDbType.bit, 1))
myCommand.Parameters("@Partners").Value = 0
else
myCommand.Parameters.Add(New SqlParameter("@Partners", SqlDbType.bit, 1))
myCommand.Parameters("@Partners").Value = 1
End If

If Support.Checked = false Then
myCommand.Parameters.Add(New SqlParameter("@Support", SqlDbType.bit, 1))
myCommand.Parameters("@Support").Value = 0
else
myCommand.Parameters.Add(New SqlParameter("@Support", SqlDbType.bit, 1))
myCommand.Parameters("@Support").Value = 1
End If

myCommand.Connection.Open()
' Test whether the new row can be added and display the
' appropriate message box to the user.
Try
myCommand.ExecuteNonQuery()
Message.InnerHtml = "Record Added<br>" & insertCmd
Catch ex As SqlException
If ex.Number = 2627 Then
Message.InnerHtml = "ERROR: A record already exists with " _
& "the same primary key"
Else
Message.InnerHtml = "ERROR: Could not add record, please " _
& "ensure the fields are correctly filled out"
Message.Style("color") = "red"
End If
End Try

myCommand.Connection.Close()
BindGrid()
End Sub

Any response would be appreciated

View 2 Replies View Related

Multiple Checkbox Field Width In A Report Parameter.

Oct 30, 2007

Hello,

I have a report where I'm showing a list of users to select.
When previewing the report, the width of the field is automatically set to the largest label in the dropdown list.
But when I change the parameter to have "Multi-Values", then the width is set to a fixed value and a horizontal scrollbar appears.
Does anyone know how to have a "Multi-Values" parameter, but keeping the lasgest width of the labels in the dropdown list ?

Thanks in advance

View 3 Replies View Related

Checkbox Data-bound To A Bit SQL Field Can't Handle NULL Values

Jun 18, 2004

I have a checkbox on my webform that is bound to a bit field in my SQL table. I'm fine as long as I've got the bit field set to 0 or 1, but if the field is NULL, the checkbox throws an exception during the databind.

Is there any way to handle this without removing the data binding and manually setting the value (ie: some way to intercept it before the exception gets thrown and then setting the field value in the dataset)?

Thanks!

View 1 Replies View Related

Save SQL XML Field Type To A Xml File

Jul 14, 2007

Hi, I have a table which holds raw xml in a field with type XML. How do I export that XML field to an XML file? Thanks Bones 

View 6 Replies View Related

How To Save To Datetime Field Without Milliseconds

Jul 4, 2015

I'm trying to save a datetime value from vb.net to a sql server.I'm using this code: Dim dt As DateTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")
After I save this value to Database.But on sql server management studio , I see that the field's value still has the milliseconds .

View 14 Replies View Related

Save Only The Date In A Datetime Field

Feb 28, 2007

Hello. A question please. Can I save only the date in a datetime field ? I don't want the hours.

View 16 Replies View Related

Create Rich Text From A Select And Save It In A Field

Jun 28, 2007

Hi,
I want to execute some queries inside a stored procedure, get the data and create from them some strings with formatted parts (bold, italic, underline, different color fonts) and save them in a text field. These strings are going to be displayed in some DBRichText control in a database application built with Delphi. Is there an easy way to create these complex rtf formats in MSSQL
or some ideas regarding this problem?

Best Regards,
Manolis Perrakis

View 1 Replies View Related

Integration Services :: Web Service Has Image Field - How To Save To Disk

Jun 5, 2015

I have to access a web service where I pass in a product number and it produces an XML result with an /image section where it has a long string (base64?)    I am trying to call the web service and save the image to the OS.

I am trying to get the result into a variable and save it to disk with  the itemno.jpg as the name

This is a sample file I get back..

<NewDataSet>
  <Table>
    <ITEMNO>2065</ITEMNO>
    <Image>/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNr ...  removed since too long for post  ...</Image>
    <ImageDate>2015-04-15T00:00:00+00:00</ImageDate>
  </Table>
</NewDataSet>

View 9 Replies View Related

SQL Server 2005 - Save Tran Save Point Name Case Sensitive?

Feb 11, 2006

Hello:I didn't find any documentation that notes save point names are casesensitive, but I guess they are...Stored Proc to reproduce:/* START CODE SNIPPET */If Exists (Select * From sysobjects Where Type = 'P' and Name ='TestSaveTran')Drop Procedure dbo.TestSaveTranGoCreate Procedure dbo.TestSaveTranAsBeginDeclare@tranCount int--Transaction HandlingSelect @tranCount = @@TRANCOUNTIf (@tranCount=0)Begin Tran localtranElseSave Tran localtranBegin Try--Simulate Error While ProcessingRAISERROR('Something bad happened', 16, 1)/*If this proc started transaction then commit it,otherwise return and let caller handle transaction*/IF (@tranCount=0)Commit Tran localtranEnd TryBegin Catch--Rollback to save pointRollback Tran LOCALTRAN --<< NOTE case change--Log Error--Reraise ErrorEnd CatchEndGo--Execute Stored ProcExec dbo.TestSaveTran/*Should receive the following message:Cannot roll back LOCALTRAN. No transaction or savepoint of that namewas found.*//* END CODE SNIPPET */What is really strange, if there is a transaction open, then no erroris thrown. So if you execute as so:/* START CODE SNIPPET */Begin Tran--Execute Stored ProcExec dbo.TestSaveTran/* END CODE SNIPPET */There is no "Cannot roll back LOCALTRAN...." message.Questions:1-)Can someone confirm save point names are case sensitve and this isnot happening because of a server setting?2-)Is this a logic error that I am not seeing in the example codeabove?We have changed our code to store the save point name in a variable,which will hopefully mitigate this "problem".Thx.

View 4 Replies View Related

DateTime Unable To Save In Datetime Field Of SQL Database

Mar 14, 2007

 Hi all, having a little problem with saving dates to sql databaseI've got the CreatedOn field in the table set to datetime type, but every time i try and run it i get an error kicked up  Error "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.The statement has been terminated."I've tried researching it but not been able to find something similar.  Heres the code: DateTime createOn = DateTime.Now;string sSQLStatement = "INSERT INTO Index (Name, Description, Creator,CreatedOn) values ('" + name + "','" + description + "','" + userName + "','" + createOn + "')"; Any help would be much appreciated 

View 4 Replies View Related

How Can I Change The Default Save-As/Save Directory

Jun 26, 2007

I am new to sql sever management studio express, but a long time query analyzer user. This is a very basic question.



I want to change the default directory in sql server management studio express so that when I go to save a query, it is already pointed to the correct one. Where do I change that?



Thanks,

Nanci





View 2 Replies View Related

Checkbox

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

SQL Statement Checkbox

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

How Can I Make Checkbox

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

Different Name For NULL Checkbox

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

Checkbox Value In Table On Sql-server

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

Checkbox Only Records Value Of 1 To DB Table

Apr 29, 2008

<asp:CheckBox ID="chkName" Checked='<%#Bind("FirstName_Disp")%>' runat="server" />
<asp:SqlDataSource ID="srcProfile" runat="server" ConnectionString="<%$ ConnectionStrings:webConn %>"     SelectCommand="sp_Profile_Get" SelectCommandType="StoredProcedure"    DeleteCommand="sp_Profile_Delete" DeleteCommandType="StoredProcedure"    UpdateCommand="sp_Profile_Update" UpdateCommandType="StoredProcedure">    <SelectParameters>        <asp:SessionParameter Name="UserID" SessionField="NewUserID" />    </SelectParameters>    <DeleteParameters>        <asp:Parameter Name="UserID" />    </DeleteParameters>    <UpdateParameters>       <asp:Parameter Name="UserID" /> ****
<asp:Parameter Name="Name_Disp" Type="Byte" />
****</UpdateParameters></asp:SqlDataSource> 
 ALTER PROCEDURE dbo.sp_Profile_Update
@UserID uniqueidentifier,
****
@Email_Disp tinyint
****
AS

UPDATE [tbl****]
SET ****
Email_Disp = @Email_Disp
****
WHERE UserID = CONVERT(uniqueidentifier,@UserID)
 Above is a sample of a checkbox that users on my site can check/uncheck so that certain information will/will not display to other users. However, the only value that writes to the DB table--depending if it is checked or unchecked--is a 1 (checked). In a previous iteration of the page, it worked so I know it can be done but I didn't save the method. Any suggestions?

View 11 Replies View Related

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 View Related

(Select All) Checkbox As Default

Dec 14, 2006

All,

When creating a dynamic parameter list from a query, Reporting Services graciously provides a "(Select All)" checkbox. How can I select this checkbox by default so that when a user generates the report, all of the values are selected?



Thanks

View 7 Replies View Related

Add A Checkbox Report Item

Aug 24, 2006

Hi there,

I am using SQL Server 2005 Reporting Services. Right now, I have a textbox with 0 or 1 values in my report and I want to show a checkbox: checked for value 1 and uncheck for 0. Is there anyway to add a checkbox in the report?

Thanks in advance.

semaj

View 5 Replies View Related

CheckBox In Reporting Services

Oct 18, 2007



Hi !
I have a problem,i have two reports in first report i shwo names of employers and in the second i show names of their employees and i've linked these reports with navigation but there is a problem becuse i want to show details of two or three rows together in second report,and i want to have check box for this,i need to use check box in preview mode in reporting services.How to have check box to select two or three employers ?
Thanks alot.
SHIARM

View 11 Replies View Related

Can I Have A Checkbox In My Report Viewer

Jan 15, 2008

Hi,
I have a order form and i want to take it to the next level.. So i have a report in my reportserver is exceuted using a sproc. I am using an Report viewer to view the report in my web application.
So is it possible to have 2 - 3 check boxes that will populate thru the webapplication, in my report viewer and still use the report from the report server.. For eg.
The data in my report will looks like this


OrderNo PlanId PlanName ... ETc
chkbox 45 15 ABD
chkbox 46 75 BDA


any help will be appreciated.

Regards
Karen

View 4 Replies View Related

Storing Checkbox Values To Database

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

Checkbox Changed Value Doesn't Bind

May 21, 2008

The following checkbox in my FormView only records "True" to the database, even after the checkbox is unchecked. After exhausting searches for many weeks, I'm in desperate need of a resolution and would very much appreciate your expertise. From what I understand, the #Bind feature is supposed to be a 2-way binding but I don't know why it doesn't work with my checkbox controls. I know that I should use AutoPostBack="True", but when I do so, I get the error "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."
<asp:UpdatePanel ID="udp1" UpdateMode="Conditional" runat="server">    <ContentTemplate>        <asp:CheckBox ID="chkEmail" Text="Display?" TextAlign="left"             Checked='<%#Bind("Email_Disp")%>' runat="server" /><br />    </ContentTemplate>  </asp:UpdatePanel> 
<asp:SqlDataSource ID="srcProfile" runat="server" ConnectionString="<%$ ConnectionStrings:webConn %>"
SelectCommand="sp_Profile_Get" SelectCommandType="StoredProcedure"
DeleteCommand="sp_Profile_Delete" DeleteCommandType="StoredProcedure"
UpdateCommand="sp_Profile_Update" UpdateCommandType="StoredProcedure">
<SelectParameters>
<asp:SessionParameter Name="UserID" SessionField="NewUserID" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="UserID" />
[snip]
<asp:Parameter Name="Email_Disp" Type="Boolean" />
[snip]
</UpdateParameters>
</asp:SqlDataSource>

---------From DB table: Email_Disp    bit---------
ALTER PROCEDURE dbo.sp_Profile_Get
@UserID uniqueidentifierAS SELECT *
FROM [myTable] WHERE UserID = CONVERT(uniqueidentifier,@UserID)
---------
ALTER PROCEDURE dbo.sp_Profile_Update            @UserID uniqueidentifier,[snip] @Email_Disp bit,[snip]
ASUPDATE [myTable] SET [snip], Email_Disp = @Email_Disp, [snip]WHERE UserID = CONVERT(uniqueidentifier,@UserID)

View 19 Replies View Related

Trying To Insert Checkbox True/false Into Db

Aug 15, 2005

Hi there, I've tried googling this (and looking at the many questions on the forum :) but I've not managed to find a decent tutorial / guide that describes a method for using checkboxs to insert true/false flags in a MS SQL db.  The db field i'm setting has type set to "bit", is this correct?  And secondly (its been a long day!) I just cant figure out the code to assign the bit 1 or 0 / true or false. This is what I've got so far but it's not working........Function InsertProduct(ByVal prod_code As String, ByVal prod_name As String, ByVal prod_desc As String, ByVal prod_size As String, ByVal prod_price As String, ByVal prod_category As String, ByVal aspnet As Boolean) As Integer             Dim connectionString As String = "server='server'; user id='sa'; password='msde'; Database='dbLD'"             Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString)                 Dim queryString As String = "INSERT INTO [tbl_LdAllProduct] ([prod_code], [prod_name], [prod_desc], [prod_size], [prod_price], [prod_category],[aspnet]) VALUES (@prod_code, @prod_name, @prod_desc, @prod_size, @prod_price, @prod_category, @aspnet)"             Dim sqlCommand As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(queryString, sqlConnection)                 sqlCommand.Parameters.Add("@prod_code", System.Data.SqlDbType.VarChar).Value = prod_code             sqlCommand.Parameters.Add("@prod_name", System.Data.SqlDbType.VarChar).Value = prod_name             sqlCommand.Parameters.Add("@prod_desc", System.Data.SqlDbType.VarChar).Value = prod_desc             sqlCommand.Parameters.Add("@prod_size", System.Data.SqlDbType.VarChar).Value = prod_size             sqlCommand.Parameters.Add("@prod_price", System.Data.SqlDbType.VarChar).Value = prod_price             sqlCommand.Parameters.Add("@prod_category", System.Data.SqlDbType.VarChar).Value = prod_category                 If chkAspnet.Checked = True Then                sqlCommand.Parameters.Add("@aspnet","1")             Else                sqlCommand.Parameters.Add("@aspnet","0")             End If                     Dim rowsAffected As Integer = 0             sqlConnection.Open             Try                 rowsAffected = sqlCommand.ExecuteNonQuery             Finally                 sqlConnection.Close             End Try             Return rowsAffected         End Function             Sub SubmitBtn_Click(sender As Object, e As EventArgs)            If Page.IsValid then                InsertProduct(txtCode.Text, txtName.Text, txtDesc.Text, ddSize.SelectedItem.value, ddPrice.SelectedItem.value, ddCategory.SelectedItem.value, aspnet.value)                Response.Redirect("ListAllProducts.aspx")            End If    End SubAny help would be appreciated or links to tutorials.ThanksBen

View 2 Replies View Related

No SQL Server Reporting Services Checkbox?

Mar 2, 2005

Am I correct in finding that there's no checkbox in SQL Server Reporting Services? What other way do you have to display a bit field other than 0-1 ??

View 1 Replies View Related

Single Checkbox Possible When Report Parameter Is Yes Or No?

Dec 13, 2007

it looks like a multi value parameter is the only kind of parameter that displays a checkbox.

A single checkbox for yes/no parameters are more intuitive to my users than 2 choices from a query.

I tried to set the multi value attribute on such a param but at run time get errors from a couple of places 1) expressions that reference such a parameter, seemingly confused about the value field being allowed to be either an object or an integer 2) unchecking the checkbox causes a prompt demanding that a value be set.

Does anybody have a trick or see what I am missing in trying to make a parameter act like a single yes/no checkbox in just one line of a dropdown parameter list?

View 3 Replies View Related

Multiple Checkbox In A Report Parameters.

Oct 30, 2007

Hello,

I have a report in which one parameter has with multiple selections (List of CheckBoxes). SSRS automatically adds a "Select All" value as the first option. I'm showing a User Type list, but for example, usually the user running the report will be selecting two or three sets of "User Types" (*), then I named those selections and put them in the list also. The list looks like:
"Select All"
IT Users (*)
HR Users (*)
Programmers
DB Analyst... etc...

What I'm trying to do is that when the user selects "IT Users" (per example), then the options "Programmers" and "DB Analyst" will be checked automatically, because they belong to "IT Users" group.


Any help will be appreciated... Thanks in advance

View 2 Replies View Related

Select The CheckBox Inside The DataGridView

Feb 29, 2008

Hi,

Can anybody help me fetch "True" & "False" value from a CheckBox inside a DataGridView row.

I tried the following code:-

But the cell.Selected doesnot take the correct value.


objGrid = (System.Windows.Forms.DataGridView)controlObj[0];

foreach (DataGridViewRow row in objGrid.Rows)

{

DataGridViewCheckBoxCell cell = row.Cells[0] as DataGridViewCheckBoxCell;



if (cell.Value != cell.FalseValue)



{

if (cell.Selected == true)

{

///Some Code;
}

}



}


Kindly Help ASAP
Thanks

View 4 Replies View Related

Insert Into Sql Database With Checkbox List Items

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







Copyrights 2005-15 www.BigResource.com, All rights reserved