|
|
While desirialising byte[], an error message as
"Unable to translate the byte[DO]at index 1 from specified page to unicode ".
Plz suggest me some solution.
|
|
|
|
|
Hi all
I'm working in listbox. I have to store multiple items from listbox into database.
Plz help me with some sample code
Thanks in advance.....
Elizabeth..
|
|
|
|
|
Here is a peace of code, did not test it but it sould work:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace test
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
void Button1Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(@"User ID=username; Password=pass; Initial Catalog=databasename; data source=localhost");
SqlCommand cmd = conn.CreateCommand();
foreach(object i in listBox1.SelectedItems)
{
cmd.CommandText = "INSERT INTO TableName (columnName) VALUES('"+i.ToString()+"')";
cmd.ExecuteNonQuery();
}
conn.Close();
}
}
}
|
|
|
|
|
Hi,
In my application.i want to connect to server and read the files drive by drive.
I tried in local by using System.IO namespace and succeeded.
Could any body help me to connect server and retreive file list.
Shall i need to use RDC or any other option?
thanks in advance
Bobby
Have a Nice Day Dudes
|
|
|
|
|
If you dont know the names of drives you can get the names of drives using System.Management namespace with wmi.
After that i assume you have sharings on folders. then all you have to do is using a code like below
System.IO.Directory.GetFiles(@"\\10.10.0.50\d$");
Also you can use getdirectories or similar methods like this.
|
|
|
|
|
HI Tamer,
THank u very much
Till now am using Directoryinfo class,so am unable to solve this.
My remote system is provided by Username and password.so when i tried i got the following error
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalGetFileDirectoryNames(String path, String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption)
at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
at System.IO.Directory.GetFiles(String path)
at FileSearcher.Searcher.SearchThread()
is there any way to pass the credentials and then access the remote system.could u pls suggest me?
thanks in advance
Have a Nice Day Dudes
|
|
|
|
|
I think first you have to make an impersonation to a user that have rights on remote server.
Yo can find it here how to make.
Windows Impersonation using C#[^]
|
|
|
|
|
HI thanks for the reply,
Firstly i need to access the remote system based on IP address and then need to traverse the drives.
As u suggested,i used getfiles() and able to access,but the problem is, as the system is password protected, am unable to connect programatically.
so is there any way to pass the User id and password and access the remote system Harddisk drives
thanks in advance
Have a Nice Day Dudes
|
|
|
|
|
For getting drive informations of a remote computer with wmi Windows Management Instrumentation (WMI) Implementation[^] will help.
For password protection of files issue only solution that comes to my mind is impersonation(Working the application under credentials of an user that has access to that files.
|
|
|
|
|
HI Tamer,
Thanks for the reply.
But my intention is i just want to access remote system from my Window application.as its password protected,is there any way to send User name and password and then access system
Have a Nice Day Dudes
|
|
|
|
|
please read this and tell me my mistake.
cn.Open();
cmd.CommandText = "Select ATT_DATE,DEP_ID,to_char(timein,'HH:MI'),to_char(timeout,'HH:MI'),EMP_NAME from attandance where emp_id = '" + id.Text + "' and shift = '" + shift.SelectedItem + "'";
odr = cmd.ExecuteReader();
while (odr.Read())
{
ename.Text = odr["emp_name"].ToString();
dept.Text = odr["dep_id"].ToString();
timein.Text = odr["timein"].ToString();
timeout.Text = odr["timeout"].ToString();
Dte.Text = odr["att_date"].ToString();
}
|
|
|
|
|
That depends. what is going wrong ? Is there an error message ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Error Message is
INDEX OUT OF RANGE EXCEPTION WAS UNHANDLED
|
|
|
|
|
that because you dont specify return field name for time in
try change your query in "to_char('timein',...) as timein"
hope it helps
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
I change my query like;
"to_char('timein','HH:MI')as timein"
now Error Message Change
ERROR [22018] [Microsoft][ODBC driver for Oracle][Oracle]ORA-01722: invalid number
|
|
|
|
|
then try to follow this link
ORA-01722: invalid number[^]
hope it helps
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
mjawadkhatri wrote: tell me my mistake.
Not telling us what the error message says and which line it occurs on?
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Error Message is
INDEX OUT OF RANGE EXCEPTION WAS UNHANDLED
line of Error is
timein.Text = odr["timein"].ToString();
|
|
|
|
|
So, there is no column called 'timein'. I suspect you need to read a few basic books before doing any more work, the error message is pretty self documenting, and googling it would have got you a ton of info
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
In your select statement set "to_char(timein,'HH:MI')" to "to_char(timein,'HH:MI') AS 'timein'"
same with "to_char(timeout,'HH:MI')"
|
|
|
|
|
In addition to your missing columns, your code is vulnerable to SQL injection. You might want to look into stored procedures
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
"You might want to look into stored procedures parameterized statements."
(Regardless of whether or not the statement executes a stored procedure.)
|
|
|
|
|
Whoops. I thought that stored procedures and parametrized statements were the same thing. Thanks for the tip - research time methinks
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
I am developing window application in C#.NET. My form has a many images. If I run the project, images on the form are appearing one by one and form is vibrating. So plz give me any solution for this.
Thanks in advance..
|
|
|
|