|
I'm sorry, I can't really help there, as I'm unfamiliar with ASP.NET. If I recall correctly, you took over this project from somebody else, right? I imagine there should be some code handling button-clicks in other parts of the application. Maybe you can take that as a kind of template how to do it. Else I would suggest you to open a new question in the ASP.NET forum so someone else can hopefully help you there.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Okay thanks. I going to submit what I have to my Director. They will just need to name the csv what I have in the code. I never got the hours to work.
|
|
|
|
|
Sascha,
The Director is happy with code but would like to see the hours.
I looped thru the code with debug and see that the #temptable is showing the hours
but are not summing then. Would this select statement be where I need to focus?
SELECT Tmp.Name, SUM(Tmp.Hours) FROM TempTable AS Tmp WHERE NOT EXISTS (SELECT * FROM StaffTracking AS ST WHERE Tmp.Name = ST.ResourceName) GROUP BY Tmp.Name;"; I have tried several different scenarios but no results.
Thanks,
Norris
|
|
|
|
|
Hi Norris,
there's no # in front of "TempTable" there. If it's the same in your code, that might be the problem. If it's not that I have no further ideas because it works for me. I hope you'll be able to fix it - good luck!
/Sascha
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Ok. Thank you for your help.
|
|
|
|
|
Okay got it figure out for the Hours. I needed to add to sum(Tmp.Hours) as Hours.
|
|
|
|
|
Cheers!
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
io ho questo codice ma non mi riesce a mattere il dato di uscita nella stessa riga del dato di entrata. come faccio a inserire entrata e uscita nella stessa riga che contiene stesso nome sensa dupplicare.. grazie
https://social.msdn.microsoft.com/Forums/getfile/648856
https://social.msdn.microsoft.com/Forums/getfile/648857
OleDbConnection cn = DataBase.CreaConnessione();
OleDbDataAdapter ad = new OleDbDataAdapter();
Operai o = new Operai();
DateTime entrata;
DateTime uscita;
TimeSpan tmp;
private void Form2_Load(object sender, EventArgs e)
{
}
private void btnentrata_Click(object sender, EventArgs e)
{
entrata = DateTime.Now;
txtentrata.Text = entrata.ToLongTimeString();
OleDbCommand cmd = cn.CreateCommand();
cmd.CommandText = "INSERT INTO operai (cognome,nome,entrata) VALUES ('" + this.txtcognome.Text + "','" + this.txtnome.Text + "','" + this.txtentrata.Text + "')";
cmd.CommandType = CommandType.Text;
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
}
private void btuscita_Click(object sender, EventArgs e)
{
uscita = DateTime.Now;
txtuscita.Text = uscita.ToLongTimeString();
OleDbCommand cmd = cn.CreateCommand();
cmd.CommandText = "INSERT INTO operai (cognome,nome,uscita) VALUES ('" + this.txtcognome.Text + "','" + this.txtnome.Text + "','" + this.txtuscita.Text + "')";
cmd.CommandType = CommandType.Text;
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
}
|
|
|
|
|
I'm sorry but the main forums are English language only. Could you please translate your question?
|
|
|
|
|
INSERT the dates in the database access ( not Generating One new)
OleDbConnection cn = DataBase.CreaConnessione();
OleDbDataAdapter ad = new OleDbDataAdapter();
Operai o = new Operai();
private void Form2_Load(object sender, EventArgs e)
{
}
private void btnentrata_Click(object sender, EventArgs e)
{
txtentrata.Text = DateTime.Now.ToLongTimeString();
OleDbCommand cmd = cn.CreateCommand();
cmd.CommandText = "INSERT INTO operai (nome,cognome,entrata) VALUES ('" + this.txtnome.Text + "','" + this.txtcognome.Text + "','" + this.txtentrata.Text + "')";
cmd.CommandType = CommandType.Text;
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
}
private void btuscita_Click(object sender, EventArgs e)
{
txtuscita.Text = DateTime.Now.ToLongTimeString();
OleDbCommand cmd = cn.CreateCommand();
cmd.CommandText = "INSERT INTO operai (nome,cognome,uscita) VALUES ('" + this.txtnome.Text + "','" + this.txtcognome.Text + "','" + this.txtuscita.Text + "')";
cmd.CommandType = CommandType.Text;
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
}
|
|
|
|
|
Your code is vulnerable to SQL Injection[^].
NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
To update the same row, you will need to retrieve and store the ID from the new row, and then issue an UPDATE statement:
private int? _id;
private void btnentrata_Click(object sender, EventArgs e)
{
using (OleDbConnection cn = DataBase.CreaConnessione())
using (OleDbCommand cmd = cn.CreateCommand())
{
cmd.CommandText = "INSERT INTO operai (cognome, nome, entrata) VALUES (?, ?, ?)";
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("p0", txtcognome.Text);
cmd.Parameters.AddWithValue("p1", txtnome.Text);
cmd.Parameters.AddWithValue("p2", DateTime.Now);
cn.Open();
cmd.ExecuteNonQuery();
cmd.CommandText = "SELECT @@IDENTITY";
cmd.Parameters.Clear();
_id = (int)cmd.ExecuteScalar();
}
}
private void btuscita_Click(object sender, EventArgs e)
{
if (_id == null)
{
throw new InvalidOperationException("Row not created!");
}
using (OleDbConnection cn = DataBase.CreaConnessione())
using (OleDbCommand cmd = cn.CreateCommand())
{
cmd.CommandText = "UPDATE operai SET uscita = ? WHERE ID = ?";
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("p0", DateTime.Now);
cmd.Parameters.AddWithValue("p1", _id);
cn.Open();
cmd.ExecuteNonQuery();
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm doing SMS system.Unable to load DLL "dllforvc.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E).
|
|
|
|
|
That's telling you that it cannot find either dllforvc.dll or another DLL in its dependency chain. In cases like this, I would look to use this[^] to help find what's missing.
|
|
|
|
|
I think dllforv.dll is worry. Do you have available dllforvc.dll?
|
|
|
|
|
|
I ask you to help me transfer code below into C#2008 to C#2005 ?, which takes the form type class DataClass.cs
[CODE]
// Example 1:
private void PopulateArr(DataClass[] tmpArr)
{
for (int i = 0; i < 3; i++)
{
tmpArr[i] = new DataClass() { DoubleValue = seed++ }; //error this place
}
}
//Example 2:
/// public static implicit operator DataClass(double? othaNumba)
/// public static implicit operator DataClass(double othaNumba)
/// can you explain why the declaration on (Example 2a and 2b) parameters included in the question mark and no question mark ?
// Example 2a:
public static implicit operator DataClass(double? othaNumba)
{
return new DataClass() //error this place
{
DoubleValue = othaNumba == null ? null : (double?)Convert.ToDouble(othaNumba) // error this place
};
}
// Example 2b:
public static implicit operator DataClass(double othaNumba)
{
return new DataClass() // error this place
{
DoubleValue = othaNumba == null ? null : (double?)Convert.ToDouble(othaNumba) // error this place
};
}
// Example 3:
private void filterControl1_BeforeShowValueEditor(object sender, ShowValueEditorEventArgs e) // error this place
{
GridFilterColumn currentColumn = e.CurrentNode.Property as GridFilterColumn;
if (currentColumn != null)
{
e.CustomRepositoryItem = currentColumn.GridColumn.ColumnEdit;
}
}
// Error 13 The type or namespace name 'ShowValueEditorEventArgs' could not be found
// (are you missing a using directive or an assembly reference?)
[/CODE]
|
|
|
|
|
Normal Value Type variables cannot contain null values - but C# allows you to create a version that can called a Nullable Type[^] by appending a "?" to the type name when you declare the value - the link explains all this.
The rest of the code you show is pretty much rubbish: it amounts to
If the value is null , return null .
Otherwise, convert the double value to a double , then cast it to a nullable double .
Why?
The original value is a double , which can't be null (because it's a Value Type) so just cast it to a nullable double anyway...
And your other example is equally ridiculous.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Examples 1 and 2 are using object initializers[^], which were introduced with VS2008. To compile the code in VS2005, you'll need to use the older initialization syntax. For example:
tmpArr[i] = new DataClass { DoubleValue = seed++ };
DataClass temp = new DataClass();
temp.DoubleValue = seed++;
tmpArr[i] = temp;
Example 3 appears to be related to a DevExpress component. Either you're missing a reference to the component, or you're missing a using directive for the namespace, or you're using a different version of the component in your VS2005 code.
Is there a reason you're using VS2005, when VS2013 Community Edition[^] is available free of charge?
And for future reference, when you're posting a code block, this site doesn't use [CODE]...[/CODE] tags. Use either <pre> tags or fenced code blocks to format your code:
<pre>
Your code here
</pre>
Or:
```
Your code here
```
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The first of all thank you for answering me, now I want to convert the code example 2 (2a and 2b included) to C# 2005 I will write again how ?
|
|
|
|
|
I am working on C# Project [Windows Form Application], to update treeview nodes from excelsheet [xls] Cell [row i, Column 3] Values, while on selecting treenode, it should update corresponding Column 4 Value [row i, Column 4]. For me, Treenode are populated successfully, but on selecting the treenode, it always display first Element of treenode [Not selected one].
Populated Treenode from Excel as: [ Update Child Nodes from Column 3 elements [Column 2 Contain Parent node name and Column 3 have Child Node name], if Column 2 Value is same as Parent node name [My Module], update the child nodeunder same Parent node.]
for (int i = 0; i < worksheet.UsedRange.Rows.Count; i++)
{
string mynode = ((Excel.Range)worksheet.Cells[i + 1, 3]).Value2.ToString();
string mynode2 = ((Excel.Range)worksheet.Cells[i + 1, 2]).Value2.ToString();
if (mynode2 == mymodule)
{
TreeNode ChildNode = ParentNode.Nodes.Add(mynode);
ChildNode.Text = mynode;
}
}
On selecting the Child Node, it always give 1st Parent node. Instead of Selected Node.
for (int i = 0; i < worksheet.UsedRange.Rows.Count - 2; i++)
{
string mynodetext = ((Excel.Range)worksheet.Cells[i + 2, 3]).Value2.ToString();
string mynodetext1 = ((Excel.Range)worksheet.Cells[i + 2, 4]).Value2.ToString();
if (treeView1.SelectedNode.FirstNode.Text == mynodetext)
{
this.richTextBox1.SelectedText += Environment.NewLine + mynodetext1 + Environment.NewLine;
}
}
Please Guide, How to get correct selected Node.
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace webbrowser2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate(http://SomeWebiste.com);
}
private void button1_Click(object sender, EventArgs e)
{
HtmlElementCollection links = webBrowser1.Document.GetElementsByTagName("a");
foreach (HtmlElement link in links)
{
try
{
if (link.InnerText.ToString() == "How to change ip in webBroswer control?")
{
link.InvokeMember("Click");
break;
}
}
catch { }
}
}
}
}
How to spoof ip when I click specific link on "some website" with proxy ip list on my computer ?
I have implemented the code with webBroswer control like above but I don't know how to spoof the ip with proxy ip lists.
Any helps would be apppreciated
Thank you
modified 22-Apr-15 12:45pm.
|
|
|
|
|
I am not sure I understand the question, but I assume you just use the IP address instead of the URL, like:
webBrowser1.Navigate("http://173.194.67.106");
|
|
|
|
|
Sorry my English is too bad so you didn't understand what I wanted to say.
I wanna spoof my ip whenever I click the link on "Some webiste" with proxy ip lists.
Can you help me?
Thank you
|
|
|
|
|
hapiten wrote: Can you help me? Sorry, no. I have no idea how to do that, and I am not sure it is legal.
|
|
|
|
|
hapiten wrote: How to spoof ip when I click specific link on "some website" with proxy ip list
on my computer ? I have implemented the code with webBroswer control like
above but I don't know how to spoof the ip with proxy ip lists. Do you want to redirect the user to some other IP if he clicks a link in your webbrowser?
If yes, research how to build your own proxy-server using C#.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|