|
Tim Deveaux wrote: Yup see what I themed there?
Yes. Incorrect INXS lyrics.
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
|
Good comp, will you be adding to it?
|
|
|
|
|
Nice!
|
|
|
|
|
Nice intro. should jump into death metal scream-o
It could go:
It's nice outsiiiiiiiiiiid.
Finally nice outsiiiiiiiiiiid.
Think I'll walk the doooooooooog.
Yes, walk the dooooooooog.
Walk! Walk! Walk! Walk!
|
|
|
|
|
I like it, very nice!
Give me coffee to change the things I can and wine to accept the things I cannot!
JaxCoder.com
|
|
|
|
|
Excellent, Ravi! When you finish your ham sandwich, please extend it!
Will Rogers never met me.
|
|
|
|
|
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()
{
InitializeComponent();
}
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)
{
con.Open();
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();
sda.Fill(dt);
cmd.ExecuteNonQuery();
con.Close();
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
|
|
|
|
|
Well, it did exactly what you asked it to do. Now go ask in the right forum.
|
|
|
|
|
PIEBALDconsult wrote: Well, it did exactly what you asked it to do.
Latest Article - A 4-Stack rPI Cluster with WiFi-Ethernet Bridging
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
You need to do two things:
1) Learn to read about forums before you post in them - there is a very clear message at the top of the page explaining that this forum isn't for questions and pointing out where to post them. Posting here is just rude and arrogant - which doesn't generally endear you to people you want help from ...
2) Learn to read documentation - or at least think about what method names might mean. What kind of data do you think a method called AddWithValue might want? The type of value you you want to put in the DB, or the actual value you want to put in?
I'll give you a clue: it's not the type.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Because you never add any values. You add an enum value which is an integer.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
The post above mine is also correct. You need to do something like:
"cmd.Paremeters.AddwithValue("@Emp_Name", "Slow Eddie")"
I use Stored Procedures in the Database. You need to match the parameter type (Decimal, Int16, Int32, Int64, float , etc. to the stored procedure and the Table definition.
Start by checking out Data Value types in C# and SqlServer first.
Stored procedures are safer as they help to prevent SqlInjection attacks as well.
Hopes this helps. Been there myself and this works the for me.
I hate Acronyms....
|
|
|
|
|
Have you ever noticed that you get the same number of faith healers working in hospitals as you do psychics winning the lottery every week?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hey, I won the lottery last week. Four big smackeroonies. The first time I've ever matched even a single number. I'm doing the 20 year payout thing for tax reasons.
Explorans limites defectum
|
|
|
|
|
Congrats, you'll have friends coming out of the woodwork!
Give me coffee to change the things I can and wine to accept the things I cannot!
JaxCoder.com
|
|
|
|
|
That reminds me of a Dutch song, "When you win you've got friends":
Quote: Als je wint heb je vrienden
Rijen dik
Echte vrienden
Als je wint
Nooit meer eenzaam
Zolang je wint
|
|
|
|
|
Very true
Give me coffee to change the things I can and wine to accept the things I cannot!
JaxCoder.com
|
|
|
|
|
of course psychics can predict winning numbers... 1, 2, 3, 4, 5 ... didn't say that's next weeks numbers, but keep buying, it'll happen.
As any half capable physicist (the real science type) would tell you, "you can reasonably predict the future but can't measure it until it happens" - and by definition 'measurement' includes 'when'.
as to faith healers: I had one not just heal my faith, she completely eliminated it!
I mean that's better then my doc, last time I had the flu he only made the symptoms go away, still had the flu.
Message Signature
(Click to edit ->)
|
|
|
|
|
Why is everyone so cynical and sceptical these days?
Were you not aware that psychics aren't allowed to use their powers for personal gain (other than charging someone 20 quid for a few platitudes, of course).
As for faith-healing, it's simply a case of these things working better in a building where some pastor is reaping in the cash rather than one where doctors and nurses are desperately trying to keep people alive.
Alternative therapies definitely work! The last time I had a cold, a course of reiki and acupuncture sorted it out within a week.
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
OriginalGriff wrote: psychics winning the lottery every week? 0
OriginalGriff wrote: faith healers working in hospitals So, you are saying there are 0 faith healers working in hospitals? I guess that's true, I've never heard of a hospital employing faith healers but I don't think this is worded the way you meant it to be.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
It was worded very carefully: they are both groups of scam artists who prey exclusively on the vulnerable and gullible.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: It was worded very carefully: Then you ARE saying that there are 0 faith healers working in hospitals. OK.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Those nasty aliens are up to it again, at least on my gaming notebook which is capable to run XCOM: ENEMY UNKNOWN. Old foes like floaters, mutons and not to forget the dreaded cyberdisk are all present.
It can be snatched at a discount of 75% on The Humble Store.[^] for a couple of days.
It's a hefty download of about 10 Gb, but entirely worth it !
|
|
|
|
|
Definitely addictive.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|