[Solved] INSERT INTO syntax error in c#

This should work: OleDbCommand cmd = new OleDbCommand(@”INSERT INTO tbbill(invoice,[datetime],custm,total,tax,grand) VALUES(” + Convert.ToInt32(txtinvoice.Text) + “,\”” + dateTimePicker1.Value.ToString(“yyyy/MMM/dd”) + “\”,\”” + Convert.ToString(txtcn.Text) + “\”,\”” + txtttl.Text + “\”,\”” + Convert.ToInt32(cmtax.Text) + “\”,\”” + txtgrdttl.Text + “\”)”, con); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); con.Close(); EDIT: As stated by others, your query is still open to SQL injection. Dmitry’s … Read more

[Solved] What is this operation in C?

Assuming ICANON is a bit-mask, i.e. an integer with bits set to represent some feature, that statement will make sure those bits are not set in c_lflag. This is often called “masking off” those bits. The operation is a bitwise AND with the bitwise inverse (~ is bitwise inverse). So, if the value of c_lflag … Read more

[Solved] What is option -O3 for g++ and nvcc?

It’s optimization on level 3, basically a shortcut for several other options related to speed optimization etc. (see link below). I can’t find any documentation on it. … it is one of the best known options: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/#options-for-altering-compiler-linker-behavior solved What is option -O3 for g++ and nvcc?

[Solved] C++ vector of strings segfault

As panta-rei correctly pointed out, it looks like you’re trying to contain a string of the form “string” + string form of (i) but you’re actually doing pointer arithmetic which is illogical in this case (you’re just passing a pointer incremented i from some location – who knows what’s in that memory?). In order to … Read more

[Solved] Program C Simple Little Program Mistake

After the preprocessor runs, you’re left with: int main() { int girlsAge = (“14” / 2) + 7; printf(“%s can date girls who are %d or older.\n”, “Hunter Shutt”, girlsAge); return 0; } As you can see, “14” is a string, not a number. #define AGE 14 would fix it, but you’re better using variables … Read more

[Solved] How to use class method to stop loop? [closed]

You want to call a method, so you would have to add the parenthesis: myclass obj = new myclass(); obj.b = true; while (obj.notEnough()) { //Methods are always called by using the parenthesis () Thread.Sleep(5); } 6 solved How to use class method to stop loop? [closed]

[Solved] please tell me why this query not working

The error arises from a simple typo. You have spaces added to the value passed for the Sid condition. However your query should be rewritten in this way string cmdText = “select Count(*) from [user] where Sid=@sid and password=@pwd”; SqlCommand cmd = new SqlCommand(cmdText, cnn) cmd.Parameters.AddWithValue(“@sid”, textBox1.Text); cmd.Parameters.AddWithValue(“@pwd”, textBox2.Text); int count = Convert.ToInt32(cmd.ExecuteScalar()); if (count … Read more