Click here to Skip to main content
15,887,304 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Saving to DataBase Pin
Richard Deeming12-Nov-13 9:08
mveRichard Deeming12-Nov-13 9:08 
GeneralRe: Saving to DataBase Pin
Eddy Vluggen12-Nov-13 9:09
professionalEddy Vluggen12-Nov-13 9:09 
GeneralRe: Saving to DataBase Pin
Richard Deeming12-Nov-13 9:19
mveRichard Deeming12-Nov-13 9:19 
GeneralRe: Saving to DataBase Pin
Member 1038849412-Nov-13 21:28
Member 1038849412-Nov-13 21:28 
GeneralRe: Saving to DataBase Pin
Richard Deeming13-Nov-13 2:27
mveRichard Deeming13-Nov-13 2:27 
GeneralMessage Closed Pin
13-Nov-13 2:41
Member 1038849413-Nov-13 2:41 
GeneralRe: Saving to DataBase (solved) Pin
Richard Deeming13-Nov-13 2:51
mveRichard Deeming13-Nov-13 2:51 
GeneralRe: Saving to DataBase (solved) Pin
Member 1038849413-Nov-13 3:03
Member 1038849413-Nov-13 3:03 
VB
SAVE BUTTON
-------------


VB
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
    Try
        Dim strconnection As String = "Data Source=ELIANE-VAIO\SQLEXPRESS;Initial Catalog=SchoolDB;Integrated Security=True;"
        Dim _cn As SqlConnection = New SqlConnection(strconnection)
        Dim cmd As New SqlCommand
        _cn.Open()
        cmd.CommandText = "INSERT INTO StudentInfo([Code], [Full-Name], [Position], [Title], [Phone-Number], [Address], [Date-Time]) VALUES (<a href="/Members/code">@Code</a>, <a href="/Members/Name">@Name</a>, <a href="/Members/position">@Position</a>, <a href="/Members/title">@Title</a>, @PhoneNumber, <a href="/Members/address">@Address</a>, <a href="/Members/datetime">@DateTime</a>);"
        cmd.Connection = _cn
        cmd.Parameters.AddWithValue("<a href="/Members/code">@Code</a>", Val(Me.t1.Text))
        cmd.Parameters.AddWithValue("<a href="/Members/Name">@Name</a>", Me.t2.Text)
        cmd.Parameters.AddWithValue("<a href="/Members/position">@Position</a>", Me.c1.Text)
        cmd.Parameters.AddWithValue("<a href="/Members/title">@Title</a>", Me.c2.Text)
        cmd.Parameters.AddWithValue("@PhoneNumber", Me.t5.Text)
        cmd.Parameters.AddWithValue("<a href="/Members/address">@Address</a>", Me.t6.Text)
        cmd.Parameters.AddWithValue("<a href="/Members/datetime">@DateTime</a>", Me.t7.Value)
        cmd.ExecuteNonQuery()
        _cn.Close()
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
End Sub



REMOVE BUTTON
-------------
VB
Private Sub btnRemove_Click(sender As Object, e As EventArgs) Handles btnRemove.Click
        Me.StudentInfoBindingSource.RemoveCurrent()

        Dim con As New SqlConnection
        Dim cmd As New SqlCommand
        Try
            Dim strconnection As String = "Data Source=ELIANE-VAIO\SQLEXPRESS;Initial Catalog=SchoolDB;Integrated Security=True;"
            Dim _cn As SqlConnection = New SqlConnection(strconnection)
            _cn.Open()
            cmd.Connection = _cn
            cmd.CommandText = "Delete From studentInfo where code= " & Val(t1.Text)
            'cmd.Parameters.Add(New SqlParameter("<a href="/Members/code">@code</a>", 99))

            If MessageBox.Show("Do you really want to Delete this Record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = DialogResult.No Then
                MsgBox("Operation Cancelled")
                Exit Sub
            Else
                cmd.ExecuteNonQuery()
            End If
        Catch ex As Exception
            MessageBox.Show("Error while deleting record on table..." & ex.Message, "Delete Records")
        Finally
            con.Close()
        End Try
    End Sub

GeneralRe: Saving to DataBase (solved) Pin
Richard Deeming13-Nov-13 3:13
mveRichard Deeming13-Nov-13 3:13 
GeneralRe: Saving to DataBase (solved) Pin
Member 1038849413-Nov-13 3:21
Member 1038849413-Nov-13 3:21 
QuestionRe: Saving to DataBase Pin
Eddy Vluggen12-Nov-13 9:08
professionalEddy Vluggen12-Nov-13 9:08 
AnswerRe: Saving to DataBase Pin
Pete O'Hanlon12-Nov-13 9:14
mvePete O'Hanlon12-Nov-13 9:14 
QuestionRadioButton Pin
Member 103884948-Nov-13 0:03
Member 103884948-Nov-13 0:03 
AnswerRe: RadioButton Pin
Marco Bertschi8-Nov-13 0:15
protectorMarco Bertschi8-Nov-13 0:15 
AnswerRe: RadioButton Pin
Simon_Whale8-Nov-13 0:22
Simon_Whale8-Nov-13 0:22 
QuestionEntity Framework storedprocedure (Value insert) mapping with Entity attribute also need an external attribute (this is required to be input parameter) Pin
ansari81@yahoo.com7-Nov-13 2:28
professionalansari81@yahoo.com7-Nov-13 2:28 
QuestionPowerPivot Pin
ThetaClear5-Nov-13 10:21
ThetaClear5-Nov-13 10:21 
AnswerRe: PowerPivot Pin
Abhinav S5-Nov-13 17:43
Abhinav S5-Nov-13 17:43 
GeneralRe: PowerPivot Pin
ThetaClear5-Nov-13 20:19
ThetaClear5-Nov-13 20:19 
Questionnew features in 2012 as compared to 2008 and 2010 Pin
SateeshVankayala4-Nov-13 0:57
SateeshVankayala4-Nov-13 0:57 
AnswerRe: new features in 2012 as compared to 2008 and 2010 Pin
thatraja4-Nov-13 1:21
professionalthatraja4-Nov-13 1:21 
AnswerRe: new features in 2012 as compared to 2008 and 2010 Pin
Bernhard Hiller4-Nov-13 2:57
Bernhard Hiller4-Nov-13 2:57 
AnswerRe: new features in 2012 as compared to 2008 and 2010 Pin
Abhinav S4-Nov-13 4:51
Abhinav S4-Nov-13 4:51 
AnswerRe: new features in 2012 as compared to 2008 and 2010 Pin
Richard MacCutchan4-Nov-13 5:56
mveRichard MacCutchan4-Nov-13 5:56 
AnswerRe: new features in 2012 as compared to 2008 and 2010 Pin
Shameel13-Nov-13 3:55
professionalShameel13-Nov-13 3:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.