What is wrong with this
[WebMethod]
public bool syncTOmysqlcon(string Query)
{
try
{string strConnA = "Database=felcradb;Data Source=development;User
Id=root;Password=citranet";
MySqlConnection myConnectionstrSQLA = new MySqlConnection(strConnA);
MySqlCommand myCommstrSQLA = new MySqlCommand(Query);
myCommstrSQLA.Connection = myConnectionstrSQLA;
myConnectionstrSQLA.Open();
int result = myCommstrSQLA.ExecuteNonQuery();
myCommstrSQLA.Connection.Close();
return (result ==1);
}
catch(Exception ex)
{
return DataError(ex);
}
it always error when i call this webservice trough my windows apps.
felcraengine.felcracall.Service1 db = new felcraengine.felcracall.Service1();
bool tebabo = db.syncTOmysqlcon("INSERT INTO pst_settlers_contract_details
(ENTITY, APPLICANT_NO, AGREEMENT_NO, AGREEMENT_STATUS, AGREEMENT_SIGNDATE,
AGREEMENT_TYPE, APPLICANT_STATUS, DATE_EFFECTIVE, STATUS_DATE,
APPLICANT_REPLACEMENT, OLD_IC_N0, NEW_IC_N0, CREATED_BY, CREATED_DATE,
UPDATED_BY, UPDATED_DATE, UPLOADED, UPLOADED_DATE) VALUES('', '', '', '',
'2005-10-9', '', '', '2005-10-9', '2005-10-9', '', '', '', '', '2005-10-9',
'', '2005-10-9', '', '2005-10-9')");
Thanks in advance!!
--
:: KHAMAL :: 5 1274
you are returning an integar, whereas you should return "true" or "false"
bool.
"Khamal" wrote: What is wrong with this
[WebMethod] public bool syncTOmysqlcon(string Query) { try {string strConnA = "Database=felcradb;Data Source=development;User Id=root;Password=citranet";
MySqlConnection myConnectionstrSQLA = new MySqlConnection(strConnA); MySqlCommand myCommstrSQLA = new MySqlCommand(Query); myCommstrSQLA.Connection = myConnectionstrSQLA; myConnectionstrSQLA.Open();
int result = myCommstrSQLA.ExecuteNonQuery(); myCommstrSQLA.Connection.Close(); return (result ==1);
} catch(Exception ex) { return DataError(ex); }
it always error when i call this webservice trough my windows apps.
felcraengine.felcracall.Service1 db = new felcraengine.felcracall.Service1(); bool tebabo = db.syncTOmysqlcon("INSERT INTO pst_settlers_contract_details (ENTITY, APPLICANT_NO, AGREEMENT_NO, AGREEMENT_STATUS, AGREEMENT_SIGNDATE, AGREEMENT_TYPE, APPLICANT_STATUS, DATE_EFFECTIVE, STATUS_DATE, APPLICANT_REPLACEMENT, OLD_IC_N0, NEW_IC_N0, CREATED_BY, CREATED_DATE, UPDATED_BY, UPDATED_DATE, UPLOADED, UPLOADED_DATE) VALUES('', '', '', '', '2005-10-9', '', '', '2005-10-9', '2005-10-9', '', '', '', '', '2005-10-9', '', '2005-10-9', '', '2005-10-9')");
Thanks in advance!!
-- :: KHAMAL ::
hello CG..
what i've got from mysql help is this
You can use ExecuteNonQuery to perform any type of database operation,
however any resultsets returned will not be available. Any output parameters
used in calling a stored procedure will be populated with data and can be
retrieved after execution is complete. For UPDATE, INSERT, and DELETE
statements, the return value is the number of rows affected by the command.
For all other types of statements, the return value is -1.
when invoke actually i got it false....
it is not execute why????
--
:: KHAMAL ::
"CG" wrote: you are returning an integar, whereas you should return "true" or "false" bool.
"Khamal" wrote:
What is wrong with this
[WebMethod] public bool syncTOmysqlcon(string Query) { try {string strConnA = "Database=felcradb;Data Source=development;User Id=root;Password=citranet";
MySqlConnection myConnectionstrSQLA = new MySqlConnection(strConnA); MySqlCommand myCommstrSQLA = new MySqlCommand(Query); myCommstrSQLA.Connection = myConnectionstrSQLA; myConnectionstrSQLA.Open();
int result = myCommstrSQLA.ExecuteNonQuery(); myCommstrSQLA.Connection.Close(); return (result ==1);
} catch(Exception ex) { return DataError(ex); }
it always error when i call this webservice trough my windows apps.
felcraengine.felcracall.Service1 db = new felcraengine.felcracall.Service1(); bool tebabo = db.syncTOmysqlcon("INSERT INTO pst_settlers_contract_details (ENTITY, APPLICANT_NO, AGREEMENT_NO, AGREEMENT_STATUS, AGREEMENT_SIGNDATE, AGREEMENT_TYPE, APPLICANT_STATUS, DATE_EFFECTIVE, STATUS_DATE, APPLICANT_REPLACEMENT, OLD_IC_N0, NEW_IC_N0, CREATED_BY, CREATED_DATE, UPDATED_BY, UPDATED_DATE, UPLOADED, UPLOADED_DATE) VALUES('', '', '', '', '2005-10-9', '', '', '2005-10-9', '2005-10-9', '', '', '', '', '2005-10-9', '', '2005-10-9', '', '2005-10-9')");
Thanks in advance!!
-- :: KHAMAL ::
I've got it...when i remove field key in db the data will be inserted smoothly
:: KHAMAL ::
"Khamal" wrote: hello CG..
what i've got from mysql help is this
You can use ExecuteNonQuery to perform any type of database operation, however any resultsets returned will not be available. Any output parameters used in calling a stored procedure will be populated with data and can be retrieved after execution is complete. For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. For all other types of statements, the return value is -1.
when invoke actually i got it false....
it is not execute why????
-- :: KHAMAL ::
"CG" wrote:
you are returning an integar, whereas you should return "true" or "false" bool.
"Khamal" wrote:
What is wrong with this
[WebMethod] public bool syncTOmysqlcon(string Query) { try {string strConnA = "Database=felcradb;Data Source=development;User Id=root;Password=citranet";
MySqlConnection myConnectionstrSQLA = new MySqlConnection(strConnA); MySqlCommand myCommstrSQLA = new MySqlCommand(Query); myCommstrSQLA.Connection = myConnectionstrSQLA; myConnectionstrSQLA.Open();
int result = myCommstrSQLA.ExecuteNonQuery(); myCommstrSQLA.Connection.Close(); return (result ==1);
} catch(Exception ex) { return DataError(ex); }
it always error when i call this webservice trough my windows apps.
felcraengine.felcracall.Service1 db = new felcraengine.felcracall.Service1(); bool tebabo = db.syncTOmysqlcon("INSERT INTO pst_settlers_contract_details (ENTITY, APPLICANT_NO, AGREEMENT_NO, AGREEMENT_STATUS, AGREEMENT_SIGNDATE, AGREEMENT_TYPE, APPLICANT_STATUS, DATE_EFFECTIVE, STATUS_DATE, APPLICANT_REPLACEMENT, OLD_IC_N0, NEW_IC_N0, CREATED_BY, CREATED_DATE, UPDATED_BY, UPDATED_DATE, UPLOADED, UPLOADED_DATE) VALUES('', '', '', '', '2005-10-9', '', '', '2005-10-9', '2005-10-9', '', '', '', '', '2005-10-9', '', '2005-10-9', '', '2005-10-9')");
Thanks in advance!!
-- :: KHAMAL ::
Khamal,
Your return value is fine, however, I'm not sure what you're doing in
your catch block. It looks like you are returning a value retrieved
from a Function called DataError that you pass the original exception
to. I assuming that this function returns a boolean.
I'm wondering if you are actually getting an exception in one of your
lines of code that is being caught and eaten up by this DataError
function. If this is the case, you may be losing the actual exception
that might give you a better idea as to what is going wrong. Can you
confirm if you are getting an exception or not?
Peter Kelcey
hi peter..
no need to have catch seem like, it will return true or false. May be i
should enable 1 more string for error handling at catch.....if the return
value is false..no dataerror anymore....
if u have any suggestion please feel fee to suggest...
thanks..
--
:: KHAMAL ::
"Peter Kelcey" wrote: Khamal,
Your return value is fine, however, I'm not sure what you're doing in your catch block. It looks like you are returning a value retrieved from a Function called DataError that you pass the original exception to. I assuming that this function returns a boolean.
I'm wondering if you are actually getting an exception in one of your lines of code that is being caught and eaten up by this DataError function. If this is the case, you may be losing the actual exception that might give you a better idea as to what is going wrong. Can you confirm if you are getting an exception or not?
Peter Kelcey
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ramarnath |
last post by:
Problem in sending datatime format to the .net webservice from php.
description follows.
I've created a .net webservice.
..Net Webservice:
<WebMethod()> _
Public Function HelloDate(ByVal...
|
by: sunnyz |
last post by:
hi
I wanted to know whether we can store something in Session objects in
webservice.My windows application calls the webservice and i want the
data to be stored in Session object so that each user...
|
by: Lauren Quantrell |
last post by:
Obviously a newbie question but:
Is a .Net app automatically a "SmartClient" app? If I build a frontend
in VB.Net or C+.Net and use a SQL Server backend (assuming some sort of
ADO.NET involved) is...
|
by: JDeats |
last post by:
I have a WinForms based application that I'm launching over http
(Microsoft's buzz word for this is aparently "SmartClient"). I had an
issue trying to get parameters passed in through the URL that...
|
by: Razzie |
last post by:
Hey all,
I have a SOAP envelope with which I try to communicate to a webservice.
Everything is fine, but when I try to access a parameter of the webservice
method, I get the Object reference not...
|
by: sunnyz |
last post by:
hi
I wanted to know whether we can store something in Session objects in
webservice.My windows application calls the webservice and i want the
data to be stored in Session object so that each user...
|
by: pranesh.nayak |
last post by:
I'm facing an error:"String was not recognized as a valid DateTime"
whille accessing DateTime from webservice.
And when I try to set DateTime to the same webservice it fails with
error:"Date...
|
by: Ather Ali Shaikh |
last post by:
Hello all,
I am supposed to develop an e-commerce application integrated with UPS
Courier services to calculate the cost of shipment of a products. I have UPS
account number also have register a...
|
by: Mike |
last post by:
Greetings, I have an aspx page where on it is a link that calls my
smartclient (a windows form) that opens up. When the user is done in
the form, he or she hits a button that saves data and closes...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |