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 5 1430
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
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
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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,...
|
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.......
|
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...
|
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...
|
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 =...
|
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....
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
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...
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |