473,385 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

checkbox

reg
hi , i´m new in the world of vb.net. I´m using sql server, vb.net
language: my problem is : i have a table "Test" with "Text and Sure"
as row. "Sure" is a bit value. how do i insert "Sure" in the database
with the insert command in vb.net?
Thanks

May 1 '06 #1
5 1428
A bit field equates to True or False.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"reg" wrote:
hi , i´m new in the world of vb.net. I´m using sql server, vb.net
language: my problem is : i have a table "Test" with "Text and Sure"
as row. "Sure" is a bit value. how do i insert "Sure" in the database
with the insert command in vb.net?
Thanks

May 1 '06 #2
reg
Thanks for the info. I have done it this way: In the insert command I
define it this way
objCmd.Parameters.Add(New SQLParameter("@Garantie", SqlDbType.Bit,1,
"Garantie"))
And in a table block the following and then a button for insertion into
the DB.
<td>Garantie: </td>
<td>
<asp:CheckBox id="CBG" runat="server"
CssClass="textbox></asp:CheckBox>
</td>
Do I need to do something else?
Thanks

May 2 '06 #3
Yes, you need to give your parameter a VALUE!

SqlParameter paramGarantie = New SQLParameter("@Garantie", SqlDbType.Bit,1,
"Garantie")
paramGarantie.Value=CBG.Checked

objCmd.Parameters.Add(paramGarantie)

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"reg" wrote:
Thanks for the info. I have done it this way: In the insert command I
define it this way
objCmd.Parameters.Add(New SQLParameter("@Garantie", SqlDbType.Bit,1,
"Garantie"))
And in a table block the following and then a button for insertion into
the DB.
<td>Garantie: </td>
<td>
<asp:CheckBox id="CBG" runat="server"
CssClass="textbox></asp:CheckBox>
</td>
Do I need to do something else?
Thanks

May 2 '06 #4
reg
Please help, where do I put it. I am using VB. Here is the insert
portion
objSQL ="Insert into Aufträge (AuftragsDatum, Name, Vorname,
StrassePostfach, PLZ, Ort, Telefon," & _
"Bearbeiter, Garantie, ExterneNummer, RechnungsDatum, Auftraggeber,
Tätigkeit, Arbeitsfeld1, Arbeitsfeld2, Arbeitsfeld3," & _
"Angebot, Auftrag, BVName, BVStrasse, BVPLZ, BVOrt, Auftragsumme,
Schlussrechnung, Text) Values (@AuftragsDatum, @Name, @Vorname,
@StrassePostfach, " & _
"@PLZ, @Ort, @Telefon, @Bearbeiter, @Garantie, @ExterneNummer,
@RechnungsDatum, @Auftraggeber, @Tätigkeit, @Arbeitsfeld1, " & _
"@Arbeitsfeld2, @Arbeitsfeld3, @Angebot, @Auftrag, @BVName, @BVStrasse,
@BVPLZ, @BVOrt, @Auftragsumme, @Schlussrechnung, @Text)"
Dim objConn As SqlConnection = New
SqlConnection(ConfigurationSettings.AppSettings("S toeve"))
Dim objCmd as New SQLCommand(objSQL, objConn)

objCmd.Parameters.Add(New SQLParameter("@AuftragsDatum",
"txtAuftragsDatum.Text"))
objCmd.Parameters.Add(New SQLParameter("@Name", "txtName.Text"))
objCmd.Parameters.Add(New SQLParameter("@Vorname", "txtVorname.Text"))
objCmd.Parameters.Add(New SQLParameter("@StrassePostfach",
"txtStrassePostfach.Text"))
objCmd.Parameters.Add(New SQLParameter("@PLZ", "txtPLZ.Text"))
objCmd.Parameters.Add(New SQLParameter("@Ort", "txtOrt.Text"))
objCmd.Parameters.Add(New SQLParameter("@Telefon", "txtTelefon.Text"))
objCmd.Parameters.Add(New SQLParameter("@Bearbeiter",
ddlMA.SelectedItem.Value))
objCmd.Parameters.Add(New SQLParameter("@Garantie", SqlDbType.Bit,1
"Garantie"))
SqlParameter paramGarantie = New SQLParameter("@Garantie",
SqlDbType.Bit,1,"Garantie")
paramGarantie.Value=CBG.Checked
objCmd.Parameters.Add(paramGarantie)
objCmd.Parameters.Add(New SQLParameter("@ExterneNummer",
"txtExterneNummer.Text"))
objCmd.Parameters.Add(New SQLParameter("@RechnungsDatum",
SqlDbType.DateTime,8, "RechnungsDatum"))
objCmd.Parameters.Add(New SQLParameter("@Auftraggeber",
ddlAG.SelectedItem.Value))
objCmd.Parameters.Add(New SQLParameter("@Tätigkeit",
ddlT.SelectedItem.Value))
objCmd.Parameters.Add(New SQLParameter("@Arbeitsfeld1",
ddlA1.SelectedItem.Value))
objCmd.Parameters.Add(New SQLParameter("@Arbeitsfeld2",
ddlA2.SelectedItem.Value))
objCmd.Parameters.Add(New SQLParameter("@Arbeitsfeld3",
ddlA3.SelectedItem.Value))
objCmd.Parameters.Add(New SQLParameter("@Angebot", SqlDbType.Bit,1,
"Angebot"))
objCmd.Parameters.Add(New SQLParameter("@Auftrag", SqlDbType.Bit,1,
"Auftrag"))
objCmd.Parameters.Add(New SQLParameter("@BVName", "txtBVName.Text"))
objCmd.Parameters.Add(New SQLParameter("@BVStrasse",
"txtBVStrasse.Text"))
objCmd.Parameters.Add(New SQLParameter("@BVPLZ", "txtBVPLZ.Text"))
objCmd.Parameters.Add(New SQLParameter("@BVOrt"," txtBVOrt.Text"))
objCmd.Parameters.Add(New SQLParameter("@Auftragsumme",
SqlDbType.Money,8, "Auftragsumme"))
objCmd.Parameters.Add(New SQLParameter("@Schlussrechnung",
SqlDbType.Money,8, "Schlussrechnung"))
objCmd.Parameters.Add(New SQLParameter("@Text", "txtText.Text"))
objConn.Open()
objCmd.ExecuteNonQuery()
label1.visible="true"
BindData()
objConn.Close()
label1.text = "Die Datei wurde gespeichert!"
'Response.Redirect("insertAuftrag.aspx")

End Sub

Thanks

May 2 '06 #5
reg
Excuse I have forgotten to send the Page_Load portion too

Sub Page_Load()
If Not IsPostBack Then
objConn.Open()

objCmd = New SqlCommand("SELECT * FROM Mitarbeiter", objConn)
objRdr = objCmd.ExecuteReader()
ddlMA.DataSource = objRdr
ddlMA.DataValueField = "Name"
ddlMA.DataTextField = "Name"
ddlMA.DataBind()
objRdr.Close()

objCmd = New SqlCommand("SELECT * FROM Auftraggeber", objConn)
objRdr = objCmd.ExecuteReader()
ddlAG.DataSource = objRdr
ddlAG.DataValueField = "AuftraggeberName"
ddlAG.DataTextField = "AuftraggeberName"
ddlAG.DataBind()
objRdr.Close()

objCmd = New SqlCommand("SELECT * FROM Tätigkeit", objConn)
objRdr = objCmd.ExecuteReader()
ddlT.DataSource = objRdr
ddlT.DataValueField = "Text"
ddlT.DataTextField = "Text"
ddlT.DataBind()
objRdr.Close()

objCmd = New SqlCommand("SELECT * FROM Arbeiten1", objConn)
objRdr = objCmd.ExecuteReader()
ddlA1.DataSource = objRdr
ddlA1.DataValueField = "Arbeitsfeld1"
ddlA1.DataTextField = "Arbeitsfeld1"
ddlA1.DataBind()
objRdr.Close()

objCmd = New SqlCommand("SELECT * FROM Arbeiten2", objConn)
objRdr = objCmd.ExecuteReader()
ddlA2.DataSource = objRdr
ddlA2.DataValueField = "Arbeitsfeld2"
ddlA2.DataTextField = "Arbeitsfeld2"
ddlA2.DataBind()
objRdr.Close()

objCmd = New SqlCommand("SELECT * FROM Arbeiten3", objConn)
objRdr = objCmd.ExecuteReader()
ddlA3.DataSource = objRdr
ddlA3.DataValueField = "Arbeitsfeld3"
ddlA3.DataTextField = "Arbeitsfeld3"
ddlA3.DataBind()
objRdr.Close()
objConn.Close()
End If
End Sub

May 2 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Fabri | last post by:
How can I, on button click, to select ONLY the following 4 checkbox? I would like to do this without a for loop through form.lenght because this is only an example and I have to apply this script...
4
by: feanor | last post by:
I need to select children checkboxes when selecting the parent one. This is my function: function SelectChildrens(checkbox_name){ form = document.forms; Sname = checkbox_name.split("-"); for...
0
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
2
by: bebop | last post by:
I'm using three checkbox web controls in C# .NET and one button, and one labe Is there a way to "group" these individual checkbox web controls If so, do I use a for loop, hashtable, array,...
5
by: DotNetJunkies User | last post by:
1. i want to populate checkboxlist using javascript only at client side ....how can i do this..by populate word i mean that checkboxes should be checked or unchecked on some condition basis.......
2
by: Adam Knight | last post by:
Hi all, I have a datagrid with a checkbox in one column. The checkbox is set to autopostback and calls a method named UpdateMailSubscribers. The first click on the checkbox cause the page to...
2
by: Ceema M via DotNetMonster.com | last post by:
Hello all, I have a nested repeater, which displays categories(parent repeater) and corresponding subcategories(child repeater). Both repeaters have checkboxes. When I check category checkbox...
4
by: Wolfgang Uhr | last post by:
Hello I've the following code Panel pnlData = new System.Windows.Forms.Panel(); CheckBox checkBox = new System.Windows.Forms.CheckBox(); checkBox.AutoSize = true; checkBox.Dock =...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.