15,891,828 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Rodrigo Mendes 2022 (Top 7 by date)
Rodrigo Mendes 2022
27-Sep-22 9:24am
View
sorry for the delay in answering, the problem was in SSMS that the data type was not changing
thanks
Rodrigo Mendes 2022
27-Sep-22 6:59am
View
Now the error is this System.Data.SqlClient.SqlException: 'Conversion failed when converting the varchar value '@Disco' to data type int.'
Rodrigo Mendes 2022
27-Sep-22 6:13am
View
Thanks again for the reply, I checked SSMS and and made the changes now it shows this error:
System.Data.SqlClient.SqlException: 'Invalid column name 'Utilizador'.'
Rodrigo Mendes 2022
27-Sep-22 5:37am
View
private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=OPCOSQL\\OPCOSQL;Initial Catalog=OPCO-SQL;Integrated Security=True;Pooling=False");
con.Open();
SqlCommand cmd = new SqlCommand("insert into [Table] ([Utilizador], [Nome], [Disco], [Processador], [Memória], [Tipo], [Localização]) values (@Utilizador, @Nome, @Disco, @Processador, @Memória, @Tipo, @Localização)", con);
cmd.Parameters.AddWithValue("@Utilizador", textBox1.Text);
cmd.Parameters.AddWithValue("@Nome", textBox2.Text);
cmd.Parameters.AddWithValue("@Disco", textBox3.Text);
cmd.Parameters.AddWithValue("@Processador", textBox4.Text);
cmd.Parameters.AddWithValue("@Memória", textBox5.Text);
cmd.Parameters.AddWithValue("@Tipo", textBox6.Text);
cmd.Parameters.AddWithValue("@Localização", textBox7.Text);
cmd.ExecuteNonQuery();
con.Close();
}
Rodrigo Mendes 2022
27-Sep-22 5:15am
View
Thanks for the answer, but it didn't work and I still get the error
Rodrigo Mendes 2022
27-Sep-22 5:14am
View
Thanks for the answer, but it didn't work and I still get the error
Rodrigo Mendes 2022
27-Sep-22 4:50am
View
CREATE TABLE [dbo].[Table] (
[AssetNumber] INT NOT NULL IDENTITY,
[Utilizador] VARCHAR(50) NULL,
[Nome] VARCHAR(50) NULL,
[Disco] VARCHAR(50) NULL,
[Processador] VARCHAR(50) NULL,
[Memória] VARCHAR(50) NULL,
[Tipo] VARCHAR(50) NULL,
[Localização] VARCHAR(50) NULL,
CONSTRAINT [PK_Table] PRIMARY KEY ([AssetNumber])
);
Show More