|
Hello Folks,
I really need help to solve a real stupid situation
I have a SQL Server database table named MAINT_START.Columns of this table are:
PlateNumber char(11)--------> PK
MaintEntryDate smalldatetime---> PK
MaintReason char(20)
I want to update this table's MaintReason column via a SQL String. My code is like this:
/**********************************************************************
string strUpdate="UPDATE MAINT_START SET MaintReason='" + cMaintReason.Text.TrimEnd() + "'," +
" MaintCompany='" + cMaintCompany.Text.TrimEnd() + "'," +
" MaintCompanyTel='" + cMaintCompanyTel.Text.TrimEnd() + "'," +
" MaintCompanyAddress='" + cMaintCompanyAddress.Text.TrimEnd() + "'" +
" WHERE PlateNumber='" + cPlateNumber.Text + "' AND" +
" MaintEntryDate =Convert.ToDateTime(cMaintEntry.Text)";
SqlCommand aCommand=new SqlCommand(strUpdate,Myconnection);
/************************************************************************
Dear friends is it really impossible to insert or update a smalldatetime column?
Please Help..
|
|
|
|
|
|
Firstly I would like to say thank you for you attention. I already tried to get success result via a stored procedure. And unfortunately the result was not ok.Here is my stored procedure:
/****************************************************************
CREATE PROCEDURE [MaintStartUpdate]
(@PlateNumber_1 [char],
@MaintEntryDate_2 [smalldatetime],
@MaintReason_5 [char](20),
@MaintCompany_6 [char](20),
@MaintCompanyTel_7 [char](11),
@MaintCompanyAddress_8 [nvarchar](50))
AS
UPDATE [CollLogistics].[dbo].[MAINT_START]
SET
[MaintReason] = @MaintReason_5,
[MaintCompany] = @MaintCompany_6,
[MaintCompanyTel] = @MaintCompanyTel_7,
[MaintCompanyAddress] = @MaintCompanyAddress_8
WHERE
PlateNumber = @PlateNumber_1 AND
[MaintEntryDate]= @MaintEntryDate_2
GO
/**************************************************************
I really want to crash my computer right now. Because this is a very stupid and easy SQL update...And I still could not do anything!
|
|
|
|
|
|
I am really sorry for my bad english..
The question is I think very simple? How can I send a smalldate parameter from c# to SQL server. That's all!
|
|
|
|
|
|
I'm not really that experienced in SQL, but...
We all know that queries are only text, so if you want to pass a date to SQL server, you should pass it as a text. And why not? I believe it would be something like:
string strUpdate="UPDATE MAINT_START SET MaintReason='" + cMaintReason.Text.TrimEnd() + "'," +
" MaintCompany='" + cMaintCompany.Text.TrimEnd() + "'," +
" MaintCompanyTel='" + cMaintCompanyTel.Text.TrimEnd() + "'," +
" MaintCompanyAddress='" + cMaintCompanyAddress.Text.TrimEnd() + "'" +
" WHERE PlateNumber='" + cPlateNumber.Text + "' AND" +
" MaintEntryDate =" DateTime.Parse(cMaintEntry.Text).ToString();
Did you notice the Parse-ToString way?
Another way if you really want to pass it as a datetime -I really can't see why the persistence - perhaps you should consider using Typed datasets rather than SQLCommands?? Just a suggestion.
I hope that was close enough;)
|
|
|
|
|
|
I am unable apply visual themes and effects in my application. which file i should use to inherit the class and its members to my application to use its effects.
Crack the core
|
|
|
|
|
I'm assuming you're talking about Windows XP themes...
There are a couple of things you have to do (with 2003 projects anyway, with 2005 I don't know that it's necessary) to show XP themes.
You have to set the FlatStyle property of all UI components that have the property to System:
this.checkBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
And you need to include a manifest file named "YOUR_EXE.exe.manifest" in the project like the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="YOUR_EXE"
type="win32"
/>
<description>.NET control deployment tool</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
Where YOUR_EXE is the name of your exe. It's been a while, but I think that's all you have to do. Good luck.
Visit BoneSoft.com
|
|
|
|
|
hi all,
> how can i transfer a textbox.text with a dll from winapp1 to winapp2 ?
> the two applications do different jobs. but they have some textboxes in common.
so i just want the user to fill the winapp2.
when he/she clicks on save button, i want to transfer same values with a dll to the winapp1 and that dll should call save button event on winapp1 in it as well.
is this possible ?
if yes, how can i achieve this ?
help please,
thanks in advance,
bye.
|
|
|
|
|
Use an interface dll. Both projects will reference the interface and implement it as well.
|
|
|
|
|
i am using sql server along with C#
i want to use both string and integer values in one query and i am writing this query below
return "Insert INTO "+tableName+" (id,name,client,expstartdate,expenddate,cost,description)Values('+createpro.propertyPId+','"+createpro.propertyPname+"','"+createpro.propertyClient+"','"+createpro.propertyExpStDate+"','"+createpro.propertyExpEndDate+"','+createpro.propertycost+','"+createpro.propertydescription"')";
but this query giving an error,
is this query is right for the solution of my problem; if not then give me the solution
muhammad mahmood ilyas
|
|
|
|
|
put your query string in a local variable and display it. you will see that there are missing quotes. it looks like you mixed quote and apostrophe up.
try this (untested; im not sure about the date format):
"Insert INTO " + tableName + " (
id,
name,
client,
expstartdate,
expenddate,
cost,
description) Values( " +
createpro.propertyPId + ", " +
"'" + createpro.propertyPname + "', " +
createpro.propertyClient + ", " +
"'" + createpro.propertyExpStDate + "', " +
"'" + createpro.propertyExpEndDate+ "', " +
"'" + createpro.propertycost + "', " +
"'" + createpro.propertydescription + "'" +
")"
|
|
|
|
|
|
hi try this one:-
"Insert INTO "+tableName+" (id,name,client,expstartdate,expenddate,cost,description)Values('+createpro.propertyPId+',' "+createpro.propertyPname+" ',' "+createpro.propertyClient+" ',' "+createpro.propertyExpStDate+" ',' "+createpro.propertyExpEndDate+" ','+createpro.propertycost+',' "+createpro.propertydescription" ')";
|
|
|
|
|
|
thank you every one for taking interest in my query
muhammad mahmood ilyas
|
|
|
|
|
Hi all,
greetings.can any one give me the coding for searcha customer details in a web page by giving any of the details of a customer like customer id,or city,or country, like that.since i'm new new to C# kindly any one tell me the coding for the mentioned above in C#.
Babu
|
|
|
|
|
This problem has little to do with web programming. Once you have the result of your search, you can assign it to a datagrid and you'll be able to see it. What matters is, where is the data coming from, and how do you hope to gain access to it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I have a picture box designated as the one of the designs of my form, the problem is, when i assign an mdichild to my form, that mdichild is always at the back(behind) of my picturebox and i can't find any solution to put it in front of my picturebox... i need your help.. thanks a lot!
|
|
|
|
|
It should be possible to change the Z-Order, by calling MoveToBack() or something like that. I don't know the exact name of the method, since I dont have C# here right now.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hello
After instantiating the mdichild call the BringToFront() method.
|
|
|
|
|
Hi
first put the picture box in a frame or in the group box then create mdichild
|
|
|
|
|
Hello,
Can you please tell me how can I show an icon on a listView control?
Thank you.
|
|
|
|