15,792,870 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Python questions
View PHP questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Tshumore (Top 29 by date)
Tshumore
4-Jun-21 6:48am
View
I have since removed NewCodesCount and the result is still the same , the flow automatically redirects to else part even when its supposed to go to the URL specified in the If
Tshumore
10-Aug-20 6:23am
View
I have been getting an error whenever i open it in Excel that says : The file format and extension of '' dont match. The file could be corrupted or unsafe.
Tshumore
19-Jul-20 10:30am
View
Just to clarify there is an error when i actually created the SP. The error was on the line
DECLARE
currentSystemDate VARCHAR2(128 Byte); (red line on VARCHAR2 which says Syntax error.Partially recognized rules (railroad diagrams))
Tshumore
19-Jul-20 10:09am
View
Sorry thats a typo , i have amended with the appropriate error block.
Tshumore
18-Jun-20 7:04am
View
server is getting the BizTalkserver record from a database table. I have stepped through the value is correct :
root\\FBXDCZIMFTS01
I have even tried to use server name with fully qualified name that specifies the BizTalk database but get same exception :
root\\FBXDCZIMFTS01:BizTalkMgmtDb
When i inspect query this is what i get : https://drive.google.com/file/d/1natMNMkHP2KVUzt60sZSRjU3ecthSPox/view?usp=sharing
Tshumore
18-Jun-20 2:45am
View
The issue was with permissions. My IP address needed to be added to Exchange Server as an email originator
Tshumore
12-Jun-20 9:31am
View
Tried using that way . I still get the same exception "The remote certificate is invalid according to the validation procedure."
Tshumore
9-Jun-20 8:07am
View
I have amended the code as in the solutions. The problem is at String[] strlist . strlist returns only 6 substrings - actually only the 6 substrings for the first line. Its not repeating for each returned line. Unless im missing something very obvious i think this is where the flow is failing
Tshumore
9-Jun-20 7:53am
View
The problem is at String[] strlist . strlist returns only 6 substrings - actually 6 substrings for the first line only. Its not repeating for each returned line.
Tshumore
9-Jun-20 7:47am
View
Its an array and contains 24 elements which is in actual case the whole dataset. The problem however is when i read and add them to servers object. Im only getting 1
Tshumore
27-May-20 23:15pm
View
When i use Linq i am getting error :
Cannot convert from 'bool' to 'system.func<renci.ssh.sftp.sftpfile, bool="">
Tshumore
22-May-20 2:40am
View
Perfect ! Works like a charm
Tshumore
29-Jan-20 8:51am
View
Typo, i have amended as necessary now im getting Exception Caught during processing: The entity name must immediately follow the '&' in the entity reference. on line
string outresult = componentExecutor.Execute(authVoucher, "", ComponentName, ComponentMethod, "", inputPayload);
Tshumore
29-Jan-20 8:51am
View
Deleted
Typo, i have amended as necessary now im getting Exception Caught during processing: The entity name must immediately follow the '&' in the entity reference. on line
string outresult = componentExecutor.Execute(authVoucher, "", ComponentName, ComponentMethod, "", inputPayload);
Tshumore
29-Jan-20 8:51am
View
Deleted
Typo, i have amended as necessary now im getting Exception Caught during processing: The entity name must immediately follow the '&' in the entity reference. on line
string outresult = componentExecutor.Execute(authVoucher, "", ComponentName, ComponentMethod, "", inputPayload);
Tshumore
22-Jan-20 4:49am
View
Ok i get it. So what permissions do i need to change, in which folder, to enable this
Tshumore
6-Jan-20 10:44am
View
Thanks guys, but is there something amiss in how im passing the parameters to stream
Tshumore
25-Dec-19 8:16am
View
@MadMyche. I want EmployeeNumber to be an array , its an overtime requisition for multiple employees hence I have used ListBoxFor. in the controller i have var employees = request.EmployeeNumber.Split(','); which then extracts the selected employees.
I have amended the code to have :
request.EmployeeNumber = new string[] { Convert.ToString(formcollection["EmployeeNumber"]) };
but im getting an exception Argument 1: Cannot convert from 'System.Collections.Generic.IEnumerable<string> to string for the employee object on the line
foreach (var employee in employees)
{
request.OverTimeAmount = payrun.CalculateOverTimeAmount(employee, request.RateId); //employee
What am i doing wrong.
Tshumore
20-Dec-19 5:57am
View
Thanks Richard, regrets a typo when writing the question. I have amended the program as per your comments. I am now getting an exception for 'item' in the foreach loop : "foreach statement cannot operate on variables of type 'ContractData' because 'ContractData' does not contain a public instance definition for 'GetEnumerator'
Tshumore
13-Nov-19 11:54am
View
ok thanks
Tshumore
13-Nov-19 11:37am
View
I have removed . The form attempts a PostBack but still reloads back with form values filled in. In the database table its not committing anything still
Tshumore
13-Nov-19 2:16am
View
Thanks @RichardDeeming. This validates the dropdownfor well but i am getting an exception "The ViewData item that has the key 'BankId' is of type 'System.Int32' but must be of type 'IEnumerable<selectlistitem>'." Im getting this on all other DropDowns for the form , i have tried re-assigning the model back as :
[HttpPost]
public ActionResult Bank(Models.Employee.Registration bank)
{
if (!ModelState.IsValid)
{
bank.Banks = PopulateBank();
return View(bank);
}
try
{
using (SqlConnection conn = new SqlConnection(Helpers.DatabaseConnect))
using (SqlCommand cmd = new SqlCommand("SaveEmployeeBankDetail", conn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@EmployeeNumber", bank.EmployeeNumber);
cmd.Parameters.AddWithValue("@BankId", bank.BankId);
conn.Open();
cmd.ExecuteNonQuery();
}
return RedirectToAction("Index");
}
catch (Exception)
{
var data = from p in bank.SortCodes
select new
{
BankName = p.Text,
BankId = p.Value
};
SelectList list = new SelectList(data, "BankId", "BankName");
ViewBag.SortCodes = list;
ViewBag.ErrorMessage = Helpers.Messages.GENERAL_ERROR;
return View();
}
}
Tshumore
30-Sep-19 5:46am
View
Sorry typo. I meant to say with code above 2nd set SHOULD update to .. For now i can only update the 1st set as illustarted. Thanks in advance to all who can offer additional insight
Tshumore
30-Sep-19 5:43am
View
I am able to get all the DISTINCT duplicates sets using :
var duplicateBrokers = gnbc.FindDuplicates(p => p.Code);
var result = duplicateBrokers.Distinct(StringComparer.OrdinalIgnoreCase);
Output
ALID-HEA-CO-001
EMIL-MTR-CO-012
Using this representative result set i have been able to update all values in the first DISTINCT duplicates set using the following snippet:
static void Main(string[] args)
{
NewAGAgentMapping();
}
public static void NewAGAgentMapping()
{
List<broker> gnbc = GetData();
using (SqlConnection conn = new SqlConnection(Helpers.DatabaseConnect))
{
conn.Open();
Models.Broker mappinggg = new Models.Broker();
SqlCommand cmd = new SqlCommand("GetHighestAGCode", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter param = new SqlParameter("@returnValue", SqlDbType.Int);
cmd.Parameters.Add("@returnValue", SqlDbType.Int).Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
int Counter = Convert.ToInt32(cmd.Parameters["@returnValue"].Value);
int newCode = Counter + 1;
mappinggg.Counter = "AG" + newCode.ToString("000000");
conn.Close();
//Update the Duplicates
var duplicateBrokers = gnbc.FindDuplicates(p => p.Code);
var result = duplicateBrokers.Distinct(StringComparer.OrdinalIgnoreCase);
var first = result.ElementAt(0);
foreach (var dupBroker in duplicateBrokers)
{
using (SqlConnection conn1 = new SqlConnection(Helpers.DatabaseConnect))
{
conn1.Open();
Models.Broker mappingg = new Models.Broker();
var query = "UPDATE BrokerTest SET agent_shortname =@newanalysiscode WHERE agent_shortname=@firstdistinctset";
SqlCommand command = new SqlCommand(query, conn1);
command.Parameters.AddWithValue("@newanalysiscode", Convert.ToString(mappinggg.Counter));
command.Parameters.AddWithValue("@firstdistinctset", first);
SqlCommand command = new SqlCommand(query, conn1);
command.ExecuteNonQuery();
conn1.Close();
}
}
}
i.e
ALID-HEA-CO-001 -- AG00024
ALID-HEA-CO-001 -- AG00024
ALID-HEA-CO-001 -- AG00024
My question , how do i then update all values in the 2nd distinct set, 3rd distinct set etc .With code above 2nd set is successfully updating to :
EMIL-MTR-CO-012 -- AG00025
EMIL-MTR-CO-012 -- AG00025
I feel there is some LINQ method that i can apply to the "result" variable. Ideally a dynamic way of referencing the values in "result" rather than using ElementAt()... it should then be easier to update all values in duplicateBrokers that are similar to the value at index 0, 1 , 2 etc of "result".
Tshumore
27-Sep-19 10:11am
View
Thanks for the insight. I have amended to
static void Main(string[] args) {
List<broker> BrokerList = GetData();
foreach(Broker b in BrokerList) {
Console.WriteLine(b);
}
}
as above .. Console prints a list but incorrect values :
StringsTest.Models.Broker.
StringsTest.Models.Broker
StringsTest.Models.Broker
StringsTest.Models.Broker
..........................
Seems GetData() is still not retrieving values. Could it be because my SP does not have an OUTPUT parameter.
Tshumore
12-Sep-19 4:52am
View
Thanks guys.. On changing to an UPDATE statement i am still unable to insert into the columns with NULL values..What am i missing,
using (SqlConnection conn = new SqlConnection(Helpers.DatabaseConnect))
{
Models.FileUpload.Mapping mapping = new Models.FileUpload.Mapping();
SqlCommand cmd = new SqlCommand("SELECT DISTINCT transdetail_id FROM TData WHERE period_name='" + Convert.ToString(reportingPeriod) + "' AND agent_shortname IS NULL", conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read() == true)
{
mapping.TransactionDetailId = Convert.ToString(dr["transdetail_id"]);
}
else if (dr.Read() == false)
{
mapping.TransactionDetailId = string.Empty;
}
conn.Close();
SqlCommand cmd1 = new SqlCommand("SELECT company_code FROM TData WHERE transdetail_id='" + Convert.ToString(mapping.TransactionDetailId) + "'", conn);
conn.Open();
SqlDataReader dr1 = cmd1.ExecuteReader();
if (dr1.Read() == true)
{
mapping.companycode = Convert.ToString(dr1["company_code"]);
}
else if (dr.Read() == false)
{
mapping.companycode = string.Empty;
}
conn.Close();
}
using (SqlConnection conn1 = new SqlConnection(Helpers.DatabaseConnect))
{
Models.FileUpload.Mapping mapping = new Models.FileUpload.Mapping();
if (mapping.companycode == Harare)
{
String query = "UPDATE TData SET agent_shortname =@agentanalysiscode WHERE company_code=@companycode";
SqlCommand cmd3 = new SqlCommand(query, conn1);
cmd3.Parameters.AddWithValue("@company_code", Convert.ToString(mapping.companycode));
cmd3.Parameters.AddWithValue("@agentanalysiscode", HreCode);
try
{
conn1.Open();
cmd3.ExecuteNonQuery();
}
catch (SqlException e)
{
ViewBag.ErrorMessage = "Processing error !";
return View();
}
conn1.Close();
}
else if (mapping.companycode == Bulawayo)
{
String query = "UPDATE TData SET agent_shortname =@agentanalysiscode WHERE company_code=@companycode";
SqlCommand cmd3 = new SqlCommand(query, conn1);
cmd3.Parameters.AddWithValue("@company_code", Convert.ToString(mapping.companycode));
cmd3.Parameters.AddWithValue("@agentanalysiscode", ByoCode);
try
{
conn1.Open();
cmd3.ExecuteNonQuery();
}
catch (SqlException e)
{
ViewBag.ErrorMessage = "Processing error !";
return View();
}
conn1.Close();
}
}
Tshumore
9-Sep-19 9:20am
View
I have changed my SP as above. In code i no longer get DBNull exception, i can retrieve the value but it reterieves a 0.
Tshumore
9-Sep-19 7:42am
View
Runnning the query as-is without the MAX, i get the integer parts only i.e 123, 768, 769. I have changed the code to
int counter = Convert.ToInt32(cmd.Parameters["@returnValue"].Value); and indeed i still get Object cannot be cast from dbnull to other types
Tshumore
29-Aug-19 11:48am
View
Will it be a case of reading the XML data via the class then , if so how. im not entirely sure how to incorporate the deserialized object in my implementation.
Show More