|
I think you have missed the ( and ) after insert values in your query
check your code
string s = "insert into Temptransaction (date,dealercode,amounttranfer,actualamount,transactioncode)values'" + row.Cells[1].ToString() + "','" + row.Cells[2].ToString() + "','" + row.Cells[3].ToString() + "','" + row.Cells[4].ToString() + "','" + row.Cells[5].ToString() + "'";
cmd = new SqlCommand(s, con);
This should be like this try this hope this will solve your problem.
string s = "insert into Temptransaction (date,dealercode,amounttranfer,actualamount,transactioncode) values ('" + row.Cells[1].ToString() + "','" + row.Cells[2].ToString() + "','" + row.Cells[3].ToString() + "','" + row.Cells[4].ToString() + "','" + row.Cells[5].ToString() + "')";
cmd = new SqlCommand(s, con);
|
|
|
|
|
Your code is vulnerable to SQL Injection[^].
NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
using (SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=vediocon;Integrated Security=True"))
using (SqlCommand cmd = new SqlCommand("insert into Temptransaction (date, dealercode, amounttranfer, actualamount, transactioncode) values (@date, @dealercode, @amounttranfer, @actualamount, @transactioncode)", con))
{
cmd.Parameters.AddWithValue("@date", row.Cells[1]);
cmd.Parameters.AddWithValue("@dealercode", row.Cells[2]);
cmd.Parameters.AddWithValue("@amounttranfer", row.Cells[3]);
cmd.Parameters.AddWithValue("@actualamount", row.Cells[4]);
cmd.Parameters.AddWithValue("@transactioncode", row.Cells[5]);
con.Open();
cmd.ExecuteNonQuery();
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
hskjhsdfjkhdsfkjhsdklfhsodfhsdifhdsifh
|
|
|
|
|
Hello, guys
i want to create windows signup appliaction in c#.
i have a Html code of signup page.
from that code i want to create
signup app.
it must be include
3 textboxes:
1. username, 2. password, 3.captcha text
1 picrureBox for load captcha
1 refresh captcha button
1 submit button
i have this html code :
[code]
<title>MAD
USERNAME
PASSWORD
CAPTCHA
var dids = ["MIDP","ANDROID","WINDOWS","BlackBerry","SYMBIAN","MAC","WP","LINUX","IPHONE","WM"];
var curdid = 0;
function createCaptcha()
{
var chars ="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ"
+ "abcdefghiklmnopqrstuvwxyz";
var str = "";
for (var i=0; i<10; i++)
{
str += chars[ Math.floor( Math.random() * chars.length ) ];
}
var form = document.getElementById("cI");
form.s.value = str;
document.getElementById("CAPTCHA").src =
'http://register.nimbuzz.com/init?w=120&h=40&f=png&s=' + str;
form.did.value = dids[curdid];
curdid = ( curdid + 1 ) % dids.length;
}
// generate initial CAPTCHA strings:
createCaptcha( );
document.getElementById("regen").onclick = createCaptcha;
[/code]
|
|
|
|
|
Is this Windows or Web application? If Windows, it is a simple matter to create a Windows Form with the controls you need. If it is Web you already have the code.
|
|
|
|
|
To add to Richard's question: if this is not a web-based project, what is it: C# WinForms, or WPF; C++ ?
«OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. » Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."
|
|
|
|
|
I have a ListView set to use Detail mode.
Does C# allow me set a tool-tip for each individual SubItem of a ListViewItem and also allow me to detect a double-click or right-click for each individual SubItem?
Thanks
-Mike
|
|
|
|
|
Yes.
- Handle the
MouseDoubleClick event on the list view.
- Call
ListView.HitTest() to determine the target item and subitem. /ravi
|
|
|
|
|
Thanks Ravi
|
|
|
|
|
hi all !
I want to make a simple windows store application where i can stream video comming from my webcam (and from a local video file)
my question is how to capture video through a webcam and seed it over the network (localhost for exemple) , and how to connect and watch the streaming video
|
|
|
|
|
Message Closed
modified 2-Jan-15 2:24am.
|
|
|
|
|
|
I have an ASP .NET 2.0 application and am trying to add an assemble written in .NET 3.5; however, when I add the reference it appears in the references list with the dll.Refresh extension. Next, in the application the namespace is not recognized. Please help.
|
|
|
|
|
You can't add an assembly that is targeted at a higher version of the framework than the version your app is targeting: it won't be able to run the in the real world as the framework installed could well be V2.0 - and the V3.5 assembly can;t work under that.
Either recompile the referenced assembly under V2.0, or change your main application target to at least V3.5
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Built under framework 2.0 and all worked!
|
|
|
|
|
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Hi all. I wrote my first service application thanks in no small part to the Code Project community and resources. I'm now trying to figure out the best way to create a winform interface to view and change settings as well as monitor its functionality. If someone could point me in the right direction, I would greatly appreciate it.
|
|
|
|
|
That depends on how you store the settings. For a bunch of Services I wrote a while back I stored the settings in a database (recommended), so my Administration Interface maintained them there.
|
|
|
|
|
|
Hi,
I am new to this group and I have a doubt.
I have completed my C# recently so now should I go for windows apps, WPF or Windows Forms. If we talk about future, then Apps is the best thing, windows forms is definitely not the future but what about the job opportunities for a beginner, which one should I practice:.
Thanks,
Munish
|
|
|
|
|
Don’t worry about job for now. As a beginner try to learn basic about Webform, Winform, MVC, mobile App Development and WPF and etc. Who said that Windows forms are not the future? Depends on company where you will work, some company will need project should be developed only for web, some company needs for winform; some might need Web, Winform and Mobile App. So as a beginner its good you should get idea about all Microsoft technology for 2 years till you get experience .Once you get experience in Microsoft Technology then you can focus on any one development and start your carrier from there.
|
|
|
|
|
Thanks for your quick reply.
I do agree with you on everything but the thing is I am a 2013 pass out so I have to study keeping my pass out year in mind. I was thinking I should focus on something which is in demand right now or will be in the future in 3 years like apps, I could be wrong. I don't know what should I do, what path should I choose with C#.
and by demand means majority of medium or small scale companies.
|
|
|
|
|
No problem it’s about you passed out in 2013 .You can start your carrier as a fresher and prepare for interview questions,Lots of interview questions available in internet don’t focus on asp.net or winform or Mobile App development for now focus .Now you need to learn on C# OOPS concepts ,Basic SQL ,ASP.NET page life cycle and basic interview question about asp.net. Study for what is MVC related interview question. Don’t think about future for now as I told you it depends on your company where you will work. We cannot predict future so enjoy learning new things and keep on update with new technology. Get well prepare for your interview hope in a year later you will be as successful programmer. One thing keep in mind as a Microsoft software Engineer we should be ready to work on any application like asp.net, MVC, Mobile App, win form etc. If you see from long sight it will be difficult, once you get into it you feel good with learning all.
|
|
|
|
|
Member 11287260 wrote: I have completed my C# recently No, you are just at the beginning of learning to use C#, and the most demanding education is still ahead of you.
You are like someone who understands how cars are built, and driven, and what roads and highways are, but who has never actually driven a truck to deliver a load without damage to a far-off destination with a tight deadline in effect so you won't get paid unless you meet the deadline.
You may know that you must stop on a red-light, but when to pass another vehicle is a skill, and an art, on which your payday, and life, may depend: you learn that on the job.
So, yes, plunge into WinForms, WPF, ASP.NET: learn to use Controls (they're quirky beasts). Learn how to access the Web, scrape a page for content and display it hierarchically.
Learn RegEx, and Linq. Learn some flavor of SQL, and NoSQL. Know how to write a database query.
And, practice, practice, practice.
When you go to that job interview, people are going to be evaluating you for entry-level positions ... that are beyond just phone-line support and quality testing ... on enthusiasm, and curiosity, and eagerness to learn new things, as well as on the basis of what you have studied, and your grades, and diplomas.
cheers, Bill
«OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. » Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."
|
|
|
|
|
Many companies still use COBOL, or C to do much of the work, so although it looks like companies are only using the newest thing, this is not true at all. Some of the reasons include the price of software and "if it's not broken don't fix it" attitude.
If you're going C# I wouldn't start by taking directions. In fact, there is a learning curve and I would start with winforms then ASP.Net then WPF. Also learn WCF, but I found this to be a complete seperate track.
hope this helps.
|
|
|
|
|