15,911,141 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 mekenix (Top 15 by date)
mekenix
14-Dec-20 10:15am
View
Deleted
yeah well i am a dummy, but removing /100 from there did not solve it either? what do you suggesT?
mekenix
14-Dec-20 10:14am
View
well sir you won the lottery :D i am a dummy
mekenix
11-Sep-20 5:03am
View
That worked. Thanks sir
mekenix
10-Sep-20 3:22am
View
Thank you for your help sir. :)
mekenix
10-Sep-20 2:10am
View
No, My date info is in a datetime type column. I thought somehow sql did not think that its a date so tried to convert it just to be safe but that made no difference.
what if i did it like this
cm = new SqlCommand("select * from vwStockIn where sdate between @sdate and @sdate1 and status like 'Bitti'", cn);
cm.Parameters.AddWithValue("@sdate" ,DateTime.Parse(dt1.Value.ToShortDateString()));
cm.Parameters.AddWithValue("@sdate1",DateTime.Parse(dt2.Value.ToShortDateString()));
what would be the problem if i wrote it like this? Outside of unnecessary use of toshortdatestring.
A follow up question, lets think of a hypothetical scenario. I am searching for a record which is in 10:09:2020. I search it by selecting the dates 09:09:2020 and 10:09:2020. But my programme doesnt show my record. Or if i pick 10:09:2020 and 10:09:2020 which it still shows nothing. But it works when i pick 10:09:2020 and 11:09:2020 How can i fix this issue?
mekenix
10-Sep-20 1:53am
View
I think the problem is that microsoft sql expects dd,MM,yyyy value while visual studio c# gives MM,dd,yyyy value but i am not sure. Even if that was the problem i have no idea how to fix it so i need help :D
mekenix
9-Sep-20 4:42am
View
USE [meknxVT]
GO
/****** Object: Table [dbo].[tblProduct] Script Date: 9.09.2020 11:36:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tblProduct](
[pcode] [varchar](50) NOT NULL,
[barcode] [varchar](50) NULL,
[pdesc] [varchar](max) NULL,
[bid] [int] NULL,
[cid] [int] NULL,
[price] [decimal](18, 2) NULL,
[qty] [int] NULL,
CONSTRAINT [PK_tblProducte] PRIMARY KEY CLUSTERED
(
[pcode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[tblProduct] ADD CONSTRAINT [DF_tblProduct_qty] DEFAULT ((0)) FOR [qty]
GO
So what is the problem here?
mekenix
8-Sep-20 11:44am
View
Yes but there is no other key being used in the moment. How Can it have a duplicate if there is only 1 key?
mekenix
31-Aug-20 10:12am
View
oh i get it but i use this for pulling all the available brands from database to the combobox so when i try to update it and click the combobox it shows me all of those brands.
mekenix
31-Aug-20 9:38am
View
As a newbie i should say pretty hard. :D
I've been trying and still cant figure out how.
cm = new SqlCommand("Select id from tblBrand where brand like @brand", cn);
cm.Parameters.AddWithValue("@brand",cbbMarka.Text);
i've tried writing like this but it did not work.Maybe i should not write addwithvalue? i have no idea :D
Probably i am trying to add the value while i am trying to select from sql
mekenix
31-Aug-20 8:33am
View
Hello again sir, i have been trying to change my sql lines with parameterized queries.Since i have no real experience with this i have come again for your guidance.
cm = new SqlCommand("Select id from tblCategory where category like '" + cbbKategori.Text + "'", cn);
cm = new SqlCommand("Select id from tblBrand where brand like '" + cbbMarka.Text + "'", cn);
cm = new SqlCommand("SELECT category from tblCategory", cn);
How can i exactly change these lines with parameterized queries can you please explain to me?
mekenix
30-Aug-20 13:03pm
View
Oh i see it clearly now.Thank you kind sir. You've helped me greatly.
mekenix
30-Aug-20 12:16pm
View
Yeah.I am new to programming and that is a problem that i want to solve for a long time, starting now i will try to learn the code i wrote and will write.But i still do not see how the last bit saves me from future problems. Wouldnt the people who make sql injection attacks just change a few lines of code and still cause the same effect?(i am really sorry if i sound arrogantly, i am trying to learn as much from you as possible :))
mekenix
30-Aug-20 11:28am
View
I see. Thank you for the great help sir.
mekenix
30-Aug-20 11:26am
View
Welp i did not see that coming, that felt like a slap in the face :D. I knew my coding was flawed but i did not know it was THAT flawed :D,but i write this program as a training for myself so your helpful answer is more than enough for me. Thank you good sir for taking the time for helping me. But i am still unclear, what exatcly are Parameterized queries? Can you give me an example using my code?
Show More