Click here to Skip to main content
14,928,740 members

Welcome to the Lounge


For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
GeneralRe: WSO CCC 2019-06-10 - Winner Pin
Michael Martin10-Jun-19 4:41
professionalMichael Martin10-Jun-19 4:41 
GeneralA spontaneous composition Pin
Ravi Bhavnani9-Jun-19 14:58
professionalRavi Bhavnani9-Jun-19 14:58 
GeneralRe: A spontaneous composition Pin
GKP19929-Jun-19 19:29
professionalGKP19929-Jun-19 19:29 
GeneralRe: A spontaneous composition Pin
Super Lloyd9-Jun-19 20:38
MemberSuper Lloyd9-Jun-19 20:38 
GeneralRe: A spontaneous composition Pin
Ron Anders10-Jun-19 3:10
MemberRon Anders10-Jun-19 3:10 
GeneralRe: A spontaneous composition Pin
Mike Hankey10-Jun-19 4:12
professionalMike Hankey10-Jun-19 4:12 
GeneralRe: A spontaneous composition Pin
Roger Wright11-Jun-19 17:03
professionalRoger Wright11-Jun-19 17:03 
QuestionC# insert into Pin
SuperJWP9-Jun-19 8:47
MemberSuperJWP9-Jun-19 8:47 
i am trying to add data into my MSSQL table with the following C# code, however when i query the SQL table i receive numeric value in my columns, see my code.When i debug the code i receive no errors , code is successfull

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;

namespace InformationTechnologyInventoryStock
    public partial class Workstations : Form
        private int n;

        public Workstations()

        private void Workstations_Load(object sender, EventArgs e)

        SqlConnection con = new SqlConnection(@"Data Source=SH-JASONK\DEV;Initial Catalog=StockInventory;Integrated Security=True");
        private void button1_Click(object sender, EventArgs e)
            SqlCommand cmd = new SqlCommand("INSERT INTO Workstations (Emp_Name, Emp_Surname, Department, Company, Hostname, Wkst_Status, Make, Model, SerialNumber, ProductNumber, PurchaseDate, ExpiryDate, Memory, Processor, HDD, OS, MSOffice) VALUES (@Emp_Name, @Emp_Surname, @Department, @Company, @Hostname, @Wkst_Status, @Make, @Model, @SerialNumber, @ProductNumber, @PurchaseDate, @ExpiryDate, @Memory, @Processor, @HDD, @OS, @MSOffice)");
            SqlDataAdapter sda = new SqlDataAdapter(cmd);

            cmd.Parameters.AddWithValue("@Emp_Name", SqlDbType.VarChar);
            cmd.Parameters.AddWithValue("@Emp_Surname", SqlDbType.VarChar);
            cmd.Parameters.AddWithValue("@Department", SqlDbType.VarChar);
            cmd.Parameters.AddWithValue("@Company", SqlDbType.VarChar);
            cmd.Parameters.AddWithValue("@Hostname", SqlDbType.NVarChar);
            cmd.Parameters.AddWithValue("@Wkst_Status", SqlDbType.VarChar);
            cmd.Parameters.AddWithValue("@Make", SqlDbType.VarChar);
            cmd.Parameters.AddWithValue("@Model", SqlDbType.NVarChar);
            cmd.Parameters.AddWithValue("@SerialNumber", SqlDbType.NVarChar);
            cmd.Parameters.AddWithValue("@ProductNumber", SqlDbType.NVarChar);
            cmd.Parameters.AddWithValue("@PurchaseDate", dateTimePicker1.Value.Date);
            cmd.Parameters.AddWithValue("@ExpiryDate", dateTimePicker2.Value.Date);
            cmd.Parameters.AddWithValue("@Memory", SqlDbType.NVarChar);
            cmd.Parameters.AddWithValue("@Processor", SqlDbType.NVarChar);
            cmd.Parameters.AddWithValue("@HDD", SqlDbType.NVarChar);
            cmd.Parameters.AddWithValue("@OS", SqlDbType.NVarChar);
            cmd.Parameters.AddWithValue("@MSOffice", SqlDbType.NVarChar);

            cmd.Connection = con;
            DataTable dt = new DataTable();
            MessageBox.Show("INSERTED SUCCESSFULLY");



I am new to c# and would like someone to assist where i am going wrong and why i am not seeing my input data
GeneralRe: C# insert into Pin
PIEBALDconsult9-Jun-19 8:56
professionalPIEBALDconsult9-Jun-19 8:56 
GeneralRe: C# insert into Pin
Marc Clifton10-Jun-19 2:33
mvaMarc Clifton10-Jun-19 2:33 
AnswerRe: C# insert into Pin
OriginalGriff9-Jun-19 9:25
mveOriginalGriff9-Jun-19 9:25 
AnswerRe: C# insert into Pin
ZurdoDev10-Jun-19 1:54
professionalZurdoDev10-Jun-19 1:54 
AnswerRe: C# insert into Pin
Slow Eddie11-Jun-19 5:10
professionalSlow Eddie11-Jun-19 5:10 
GeneralThe world on Sunday Pin
OriginalGriff9-Jun-19 5:57
mveOriginalGriff9-Jun-19 5:57 
GeneralRe: The world on Sunday Pin
Dean Roddey9-Jun-19 6:06
MemberDean Roddey9-Jun-19 6:06 
GeneralRe: The world on Sunday Pin
Mike Hankey9-Jun-19 7:00
professionalMike Hankey9-Jun-19 7:00 
GeneralRe: The world on Sunday Pin
RickZeeland9-Jun-19 10:41
mveRickZeeland9-Jun-19 10:41 
GeneralRe: The world on Sunday Pin
Mike Hankey9-Jun-19 11:05
professionalMike Hankey9-Jun-19 11:05 
AnswerRe: The world on Sunday Pin
lopatir9-Jun-19 7:33
Memberlopatir9-Jun-19 7:33 
GeneralRe: The world on Sunday Pin
PeejayAdams9-Jun-19 23:53
MemberPeejayAdams9-Jun-19 23:53 
AnswerRe: The world on Sunday Pin
ZurdoDev10-Jun-19 1:56
professionalZurdoDev10-Jun-19 1:56 
GeneralRe: The world on Sunday Pin
OriginalGriff10-Jun-19 2:34
mveOriginalGriff10-Jun-19 2:34 
GeneralRe: The world on Sunday Pin
ZurdoDev10-Jun-19 2:38
professionalZurdoDev10-Jun-19 2:38 
RickZeeland9-Jun-19 1:43
mveRickZeeland9-Jun-19 1:43 
charlieg9-Jun-19 10:17
Membercharlieg9-Jun-19 10:17 

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.