|
I am a proud American and I try to instill the same values in the students. America use to be #1 in everything. Where are we now? I guess we are too busy making jokes. This is the CodeProject, not Comedy Central. Some of the users are going away from the core values of the CodeProject stand for. The jokes are not appreciated by me or my students. Mr. Deeming, thank you for your solution. I have not tried it yet, but looks like very professional. Thank you.
|
|
|
|
|
computerpublic wrote: I guess we are too busy making jokes.
Well, Eddy's from the Netherlands, Griff's from Wales, and I'm from England, so I don't think we can blame the Americans for that.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
We aren't about charging people for help; but we also aren't about doing other people's work for them; that doesn't help anyone in the long term.
And in the case of teachers, it doesn't help anyone in the short term either. All it does is set you up for a fall - and a big one - when one of the students needs similar help and you can't provide it because you don't understand it yourself. At that point you lose the the whole class. They lose respect for your knowledge in this subject, and at that age probably respect for your knowledge in any subject.
Then how will they learn?
Go out, or use CraigsList - not to get this fixed, but to find someone who knows how to do it, and who'd willing to give up a couple of hours a week to pass that on, with your help as a profession, trained teacher (because people who are technically talented are usually about as good at teaching what the know as a dead monkey...)
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
computerpublic wrote: I am sorry I approach you the wrong way Ditto.
computerpublic wrote: I didn't the code project forum was about charging individual for help. They don't!!
That's why I also posted a possible solution, as opposed to haggling you into some agreement. Eveything that's posted becomes a bit of public property. And of the hamsters. Bottom point is, one can't ask money for what's already given.
computerpublic wrote: You disgrace the forum From time to time, yes.
computerpublic wrote: people who genuinely join the forum to help others The forum is free. It's all simply people talking about their work, sharing bits here and there, helping each other. That's how I learned this stuff, and that's why I'm helping others with their stuff here
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You cannot engage children with text, you will lose there attention within 2 seconds. Children responds to media such as a short piece of music or video, that is why i choose to read bytes instead of what you did.
|
|
|
|
|
computerpublic wrote: string temPath = Path.GetTempFileName();
From the MSDN documentation:
Creates a uniquely named, zero-byte temporary file on disk and returns the full path of that file.
You have created an empty file; when you try to read it, you won't get any bytes returned, because it's empty.
computerpublic wrote: Console.WriteLine("{0}={1}",arry[count],buffer[count]);
As you've written it, the code would print out "NUMBER=NUMBER" for each byte in the input file. Since there are no bytes in the input file, it won't have anything to display.
computerpublic wrote: string filePath2 = Path.Combine("C:\\check", Path.GetFileName(filePath));
output.Write(buffer, 0, bytesRead);
Apart from the fact that the input file is empty, your code suggests that you're trying to write to a file in the directory C:\check , but you're actually writing to another temporary file, which will be in the %TEMP% folder.
computerpublic wrote: turn each byte into a number and SHOW IT, turn the number back to a byte and SHOW IT
A byte is a number. It's a number between 0 and 255 . There's no need to turn it into a number.
Saying "I need to turn this byte into a number" is like saying "I need to turn this fluid into a liquid". There's no conversion needed.
What I suspect you want to do is display the byte in different number bases - for example, in binary (base 2) and decimal (base 10). That's just about formatting the number, not converting it to a different type.
Based on your description, the following code should do what you're after:
using System;
using System.IO;
namespace Applica
{
static class Program
{
DirectoryInfo da = new DirectoryInfo("C:\\Folder1");
if (!da.Exists)
{
Console.WriteLine("The folder '{0}' does not exist.", da.FullName);
return;
}
FileInfo[] Arr = da.GetFiles();
if (Arr.Length == 0)
{
Console.WriteLine("There are no files in the folder '{0}'.", da.FullName);
return;
}
FileInfo ap = Arr[Arr.Length - 1];
long Totbyte = ap.Length;
string filePath = ap.FullName;
Console.WriteLine("Total Bytes = {0} bytes", Totbyte);
const int BufferSize = 1024;
byte[] buffer = new byte[BufferSize];
string destinationPath = Path.Combine("C:\\check", Path.GetFileName(filePath));
using (Stream input = File.OpenRead(filePath))
using (Stream output = File.OpenWrite(destinationPath))
{
int bytesRead;
while ((bytesRead = input.Read(buffer, 0, BufferSize)) > 0)
{
for (int count = 0; count < bytesRead; count++)
{
byte theByte = buffer[count];
string theByteInBinary = Convert.ToString(theByte, 2).PadLeft(8, '0');
Console.WriteLine("{0} = {1}", theByteInBinary, theByte);
}
output.Write(buffer, 0, bytesRead);
}
}
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The bytesRead may differ from the BufferSize. So, you should do the for from 0 to less than bytesRead (you are doing the for to less than buffer.Length).
You should use an ASCII text file for this to work, as other formats may use more than one byte per character.
You don't need that Totbyte variable... you should always use the bytesRead instead.
|
|
|
|
|
Pop up error message when I call AS400 Stored Procedures via c# application.But when I put select query to As400 via c# application it is working.
error MSG -"ERROR [HY000] [IBM][Client Access Express ODBC Driver (32-bit)][DB2/400 SQL]SQL0440 - Routine GVSP07 in AMAIN1 not found with specified parameters."
All SP parameters and SP name ok.
Please any one can help me?????
|
|
|
|
|
Well, considering you haven't shown us any code at all, all we can say is that that particular routine isn't found in that database with those specific parameters. Perhaps if you provided a bit more information, such as the code. On the plus side, you have given us details of what the exception was, which is a lot more than we usually get.
|
|
|
|
|
I mention below code that I use to call AS400 SP
(SP Name-GVSP07
OdbcConnection conOdbc = new OdbcConnection("DSN=GIFT1;UID=GIFT1;PWD=GIFT1;");
public void OpenODBCConnection()
{
try
{
if (conOdbc.State == ConnectionState.Closed)
{
conOdbc.Open();
}
}
catch (Exception ex)
{
throw ex;
}
}
OdbcCommand ODBC = new OdbcCommand("call AMAIN1.GVSP07",conOdbc);
ODBC.Parameters.Add("GR1X", OdbcType.Double, 7);
ODBC.Parameters["GR1X"].Direction = ParameterDirection.Input;
ODBC.Parameters["GR1X"].Value = 3020;
ODBC.Parameters.Add("GUSX", OdbcType.Char, 10);
ODBC.Parameters["GUSX"].Direction = ParameterDirection.Input;
ODBC.Parameters["GUSX"].Value = "g";
ODBC.CommandType = CommandType.StoredProcedure;
ODBC.ExecuteNonQuery();
|
|
|
|
|
It seems that SP AMAIN1.GVSP07 does not have GR1X (double) and GUSX (char[10]) parameters...
Can you see the SP code?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
What does your Stored Procedure look like?
|
|
|
|
|
catch (Exception ex)
{
throw ex;
} Oh no! What's the use of that catch-throw pattern that will only destroy the proper CallStack?
Some better solutions:
- Do not catch at all here - that throw ex must be handled somewhere else anyway, so don't bother.
- Log it and re-throw:
catch (Exception ex)
{
LogException(ex);
throw;
}
- wrap it in a "meaningful" exception of your own, and throw that
catch (Exception ex)
{
throw new YourConnectingToDatabaseFailedException("Could not open the connection to database ...", ex);
}
|
|
|
|
|
This is a sample code for testing C# application link to AS400 ,that why i used this simple code.anyway thanks for your comment....
|
|
|
|
|
Hi, I have one table on database and 2 data table on Program. I want join Tables with Data table
Database Table Name WarehouseStore
Field = WarehouseStoreiD,WarehouseiD, ProductiD, ProductName,ProductValue
Datatable 1 Name: dtProduct
Field = identity,iD
Datatable 2 Name: dtWarehouse
Field = identity,iD
How Can I Join them like this code on Join Sql Tables?
SELECT WarehouseStore.ProductID, WarehouseStore.ProductCode, WarehouseStore.ProductName, ,WarehouseStore.ProductValue FROM WarehouseStore INNER JOIN dtProduct ON dtProduct.iD =WarehouseStore.ProductCode INNER JOIN dtWarehouse ON dtWarehouse.iD =WarehouseStore.WarehouseiD
-- modified 7-Jul-14 5:18am.
|
|
|
|
|
Execute the query with the JOIN on the database BEFORE you load it into a datatable.
Why do you insist on doing it after loading it in a datatable?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
i can Load data warehouseStore on DataTable and insert user Data on 2 other DataTable bout I cant Join table with DataTable For show Report.
data table dtProduct Include data user select product and dtWarehouse Include data user select Warehouse and WarehouseStore Table Include All Warehouse Data.
when user insert into dtProduct ProductiD and Insert into dtWarehouse WarehouseiD must select just data on WarehouseStore When Equals to User Insert Data.
|
|
|
|
|
Mohammad Soleimani wrote: i can Load data warehouseStore on DataTable and insert user Data on 2 other
DataTable bout I cant Join table with DataTable For show Report. Why not? What error is it showing?
Can you execute the query from Sql Managment Studio to verify that it is correct?
..and yes, the result of the query would be loaded into a single datatable; that's what a join would do. Can you show the code where you execute the sql and read it into memory?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
hi,when i add datatable on Query Error show "invalid Object name 'dtProduct'.
i execute my Query on Sql Management studio its run perfect without datatable,
this is All Code
<pre lang="c#">
public DataTable Report_WarehouseStore()
{
DataTable dtProduct = new DataTable("dtProduct");
DataTable dtWarehouse = new DataTable("dtWarehouse");
DataTable dtResult = new DataTable("dtResult");
DataSet ds = new DataSet("Report");
DataColumn[] columns_p = new DataColumn[0];
dtProduct.Columns.Add("identity", typeof(int));
dtProduct.Columns.Add("iD", typeof(int));
dtProduct.Columns.Add("Title", typeof(string));
dtProduct.PrimaryKey = columns_p;
ds.Tables.Add(dtProduct);
dtProduct.Rows.Add(new object[] {1,1,"Iphone 6"});
DataColumn[] columns_w = new DataColumn[0];
dtWarehouse.Columns.Add("identity", typeof(int));
dtWarehouse.Columns.Add("iD", typeof(int));
dtWarehouse.Columns.Add("Title", typeof(string));
dtWarehouse.PrimaryKey = columns_w;
ds.Tables.Add(dtWarehouse);
dtWarehouse.Rows.Add(new object[] {1,1,"Central Warehouse"});
ds = ExecuteDataset(System.Data.CommandType.Text,@"SELECT WarehouseStore.ProductID, WarehouseStore.ProductCode, WarehouseStore.ProductName, UnitPart.UnitPart, Warehouse.WarehouseName,
WarehouseStore.ProductValue FROM WarehouseStore INNER JOIN UnitPart ON WarehouseStore.UnitPartID = UnitPart.UnitPartid INNER JOIN Warehouse
ON Warehouse.WarehouseiD = WarehouseStore.WarehouseiD INNER JOIN dtProduct ON dtProduct.iD = WarehouseStore.ProductCode INNER JOIN dtWarehouse
ON dtWarehouse.iD = WarehouseStore.WarehouseiD", null);
return ds.Tables[0];
}
</pre>
|
|
|
|
|
The SQL=query does not accept variables from C# code. You'll have to find another way to do it. Thinking about it, it'll probably be simply called "Product" in the database-server, not "dtProduct". Try changing that
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
hi, i know "SQL=query does not accept variables from C# code" Actually this is my problem! how i can join datatable with Table ? do you have any solution for this work? thanks a lot! 
|
|
|
|
|
Dear Group Members,
I am using Lucene.net for building a search engine. In course of development I came across providing filters to the search.
As I went through the Lucene documentation I came across ChainedFilter. It is a way to combine multiple filters together. However this class is not available in any of the assemblies (ver 3.0.3). The same is confirmed by multiple blog-posts. But I didn't come across any post where it is mentioned, what can be the performant way to club multiple filters together and provide it to Search().
Can someone please provide some input related to this.
Regards,
Shubhanshu
|
|
|
|
|
Lucene.net Mailing Lists[^] is where you go to ask the community of Lucene.net developers. You're not going to find a larger group of people who have used that library anywhere else.
|
|
|
|
|
Thanks Dave.
I have contacted in the specified forum by you.
Regards,
Shubhanshu
|
|
|
|
|
i'am trying to opening sub form but main form must be reduce how to add the code
I'am write using C# 2008.Thanks
Program.cs
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Linq;
namespace Mail_Gmail
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Main_Form());
}
}
}
Main_Form.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Main_Form
{
public partial class Main_Form : Form
{
public Main_Form()
{
InitializeComponent();
}
private void HelpToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 fo = new Form2();
fo.ShowDialog();
}
private void menuToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void enkripsiDanDekripsiToolStripMenuItem_Click(object sender, EventArgs e)
{
Form1 fo = new Form1();
fo.ShowDialog();
}
private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
}
private void ExitToolStripMenuItem1_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Do You want to close ???", "Confirm",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Application.Exit();
}
}
private void MessageSendToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void emailAttachmentToolStripMenuItem_Click(object sender, EventArgs e)
{
Form4 fo = new Form4();
fo.ShowDialog();
}
private void ExitToolStripMenuItem2_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Do yo want to close ini ???", "Confirm",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Application.Exit();
}
}
private void GmailToolStripMenuItem1_Click(object sender, EventArgs e)
{
Form1 fo = new Form1();
fo.ShowDialog();
}
private void SendToToolStripMenuItem_Click(object sender, EventArgs e)
{
Form5 fo = new Form5();
fo.ShowDialog();
}
private void UseThisApplicationToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 fo = new Form2();
fo.ShowDialog();
}
}
}
|
|
|
|
|