I am a beginner for C# and trying to study about ADO.NET. I wrote a simple application with a datagridview and three text boxes. I can populate data from table. Now I am trying to insert a record to a table. When I execute the following code, it is updating that table only a blank line. please can you help me to solve this problem? Or any other ways to update a record better than this?
MySQLString = "INSERT INTO Bank_Details(Bank_Code,Bank_Name,Acc_No)" +
"VALUES('"+ txtBankCode.Text +"','"+ txtBankName.Text +"','"+ txtAccNo.Text +"')";
SqlConnection MySqlConn = new SqlConnection(MyConnectionString);
SqlCommand MySqlComm = new SqlCommand(MySQLString, MySqlConn);
// MySqlConn and MySqlComm refer to variable and not the DBMS
And can anybody explain me, what are the good/bad coding practices with this?
When working with DB try your best to keep it simple.
Also, check the SQL statement if Bank_Code and Acc_No are 'int' data types then you need to convert the textboxes from string to int. i.e. Convert.ToInt32(txtBankCode.Text)
-- modified at 12:01 Thursday 11th January, 2007
Programmer: A biological machine designed to convert caffeine into code. * Developer: A person who develops working systems by writing and using software.
friends i have an windows exe file
i want to knwo whether i can run exe without .netframework installed on the system or not
if it can be done how can i embeed the required dll's to my project....
thanking u ./.
This is a repost as I didn't get a reponse to my last one and I still can't get this thing to run through. Well I lie. It ran through fine once, but since then I've been getting this contextSwitchDeadlock issue, but I haven't modified the code!
Anyone have any ideas?
Hi All,<br />
I'm slowing finding my way around C#.<br />
I have written an application that takes a directory, take each file in that directory and also each file in each subdirectory, and then trys to find any files with the same name<br />
(Trying to clear up all my duplicate photos )<br />
SO I have written the code, and checked it and checked it again, it does not get caught in an infinite loop.<br />
But when I F6 the app it comes up with a ContextSwitchDeadlock MDA issue.<br />
There is a program calling a C++ dll named "ffisamp.dll".
The C++ code is as follows:
//Simple C function that just puts something in a string
// and returns the length of that string both as the RC and as a param
// Keeping the C interface as simple as possible.
__declspec( dllexport ) int PopulateString ( char *FormsBuffer, int *BuffLen)
strcpy(FormsBuffer,"A Fixed string from within the C program");
*BuffLen = strlen(FormsBuffer);
LocalLength = strlen(FormsBuffer);
I need C# code that will compile to a dll that mimics the sample dll such that no modifications will need to be made to the calling program. I need to be able to just replace the old dll with the new one.
I am most perplexed that the C++ method is not in a class. That might be that the source code is just a snippet of the whole dll's source code... since it comes from a sample, but I have the impression from the documentation that is all of it. Here is a link to the article I am working with. I am trying to communicate with an Oracle 10g form using methods to call C functions.
AFAIK that's not possible.
C# is managed code, while C++ is unmanaged code. Data and object marshaling in both is very different -not to mention the structure of the dll file, and the method of function exporting-.
Last Visit: 31-Dec-99 19:00 Last Update: 9-Dec-23 9:11