|
i tried using wizard it shows data in data adapter
when i use
odbcConnection1.ConnectionString --> "Dsn=Visual FoxPro Tables;database ='d:\\try\try\\reconcil and bank entry\\TRY\\DOBANK\\tables'"
odbcDataAdapter1.Fill(dataSet11, "enet.dbf");
it gives error
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).
ERROR [01S00] [Microsoft][ODBC Visual FoxPro Driver]database
ERROR [01S00] [Microsoft][ODBC Visual FoxPro Driver]SourceDB
any example of using them can be helpful
thanks
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
Hi,
i made it like this :
string conn = "Driver={Microsoft dBASE Driver(*.dbf)};DriverID=277;Dbq=PATH_TO_YOUR_DBF_FILES;";
OdbcConnection Conn = new OdbcConnection(conn);
OdbcCommand Comm = new OdbcCommand("select * from xxx limit 30");
Conn.Open();
Comm.Connection = Conn;
OdbcDataAdapter DA = new OdbcDataAdapter(Comm);
DataSet DS = new DataSet("Table");
DA.Fill(DS);
DataGrid.DataSource = DS;
DataGrid.DataMember = "Table";
But somethimes it crashes, sometimes it works great ... But i read on the net thats a known bug
|
|
|
|
|
thanks
baerten
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
I think your dbf might contain a blob or general field. The data adapter can not handle the potential data. (da limit of 8000 or so, when blob could be 4 gig).
If you want to send me your dbf, I will send you a code snippet that can read it.
With all respect to the prior post, if your reading a FoxPro table AND it has one or more indexes you should not use a dbase driver. Also the dbase driver will truncate the blob masking the problem.
pmcgahan@hteinc.com
mcgahanfl@hteinc.com
|
|
|
|
|
I think your dbf might contain a blob or general field. The data adapter can not handle the potential data. (da limit of 8000 or so, when blob could be 4 gig).
If you want to send me your dbf, I will send you a code snippet that can read it.
With all respect to the prior post, if your reading a FoxPro table AND it has one or more indexes you should not use a dbase driver. Also the dbase driver will truncate the blob masking the problem.
pmcgahan@hteinc.com
mcgahanfl@hteinc.com
|
|
|
|
|
Hi,
i want to download a file from a http adres (by example http:\\www.downloadit.com\exports.xml). When i do this in my browser i get a screen where i have to give my username and password (by example username=JohnDoe and password = zzz).
Now i want to make an aspx page where i can download the file on the pageload event. Can someone give me some tips on how i can do this?
Arvind sharma
|
|
|
|
|
Use the Credentials property of the HttpWebRequest class (if you use that class).
Ex.
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://www.downloadit.com/exports.xml");
myRequest.Credentials = new NetworkCredentials("JohnDoe", "zzz");
// Make your request.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
I am dynamically creating the controls in code behind page.I also created the required field validators. It is working fine but it is showing error redirecting the page to next which I ant to stop the action there itself
Bhanu
|
|
|
|
|
HI all
built a small c# app in visual studio express edition and it works from the debugger(er)
now i run each exe file (release and debug) from outside the debugger and they
wont run.
Their size is 24k, so i figure they need to be statically linked etc but i cant see how and where in Visual Studio to do this
does anyone have any suggestions?
Bryce
-- modified at 22:33 Wednesday 18th October, 2006
|
|
|
|
|
There is no static linking to the .NET Framework. You're looking for an option that doesn't exist. Are you saying the the .EXE won't run on the development machine? Any machine that runs your app must have the .NET Framework 2.0 installed in order to work.
Well, there ARE a couple products out there that will compile your code into an .EXE that has the parts of the .NET Framework built into the app, but they cost LARGE $$$$ and introduce their own problems into the maintainability of your code.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
bugger.
Bryce
p.s. thanks
|
|
|
|
|
What do you mean when you say that "they wont run"(sic)? What happens when you try? Do you get an error message?
---
b { font-weight: normal; }
|
|
|
|
|
I'm trying to send a WM_CONTEXTMENU message to an NotifyIcon control, hoping to pop open the context menu. Am I totally off base with the following code? Needless to say, since I am posting to this forum, it isn't working.
// Send message to open context menu
Message m = new Message();
m.Msg = WM_CONTEXTMENU;
// Get notify icon native window
Type t = this.notifyIcon1.GetType();
NativeWindow icon = ((NativeWindow)t.GetField("window", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(this.notifyIcon1));
// Create message
m.HWnd = icon.Handle;
m.WParam = icon.Handle;
Int16 high = Convert.ToInt16(this.m_ptLeftClick.X);
Int16 low = Convert.ToInt16(this.m_ptLeftClick.Y);
m.LParam = (IntPtr)((Int32)(high << 16) + low);
// Send message
icon.DefWndProc(ref m);
|
|
|
|
|
I read about wininet.dll, but i'd like to know if a computer is connected as soon as is connected, how can i know it? i thought using a timer, but i don't think it's a good idea..
|
|
|
|
|
Hope following helps you
//Creating the extern function...
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ) ;
//Creating a function that uses the API function...
public static bool IsConnectedToInternet( )
{
int Desc = 0 ;
return InternetGetConnectedState( out Desc, 0 ) ;
}
- ashish
|
|
|
|
|
Yes, but the problem isn't this. I need know where a computer is connected, how can i check it? checking with this method every second with a timer?
|
|
|
|
|
So I have the following structure definition:
[StructLayout(LayoutKind.Explicit)]<br />
struct MyStruct<br />
{<br />
[FieldOffset(0)]<br />
public float f;<br />
<br />
[FieldOffset(0)]<br />
public int i;<br />
<br />
[FieldOffset(4)]<br />
public object o;<br />
<br />
[FieldOffset(4)]<br />
public ArrayList al;<br />
}
And the following program:
static void Main(string[] args)<br />
{<br />
MyStruct s;<br />
s.i = 1;<br />
s.f = 1.0f;<br />
s.al = null;<br />
s.o = new object();<br />
Console.WriteLine("float = {0}", s.f);<br />
Console.WriteLine("int = {0:x}", s.i);<br />
Console.WriteLine("object = {0}", s.o);<br />
Console.WriteLine("arraylist = {0}", s.al);<br />
Console.WriteLine("arraylen = {0}", s.al.Capacity);<br />
s.al.Remove(s.o);<br />
Console.ReadLine();<br />
}
Essentially, I'm forcing an ArrayList reference to point to an object of type Object, then calling ArrayList member functions on that Object. As you might imagine, this leads to some fairly disastrous consequences in the runtime. Calling various members of the ArrayList results in an exception being thrown:
s.al.Add(s.o): RemotingException ("Cannot load type")
s.al.Remove(s.o): AccessViolationException
s.al.BinarySearch(s.o): SEHException
Obviously this program is no longer type-safe, but running the peverify utility on the generated executable gives a thumbs-up. All of this brings me to the actual question.. is this the intended behavior of the language and runtime, or is this a bug?
Googling brings me to http://discuss.develop.com/archives/wa.exe?A2=ind0112c&L=dotnet&D=0&P=53651, but this was written five years ago and doesn't actually provide an answer to the question. What do you guys think about this behavior? Am I justified in seeing this as a security vulnerability (perhaps a plugin commits a privilege escalation attack) rather than a simple bug?
|
|
|
|
|
I see this as possible problem.
Imagine having
[StructLayout(LayoutKind.Explicit)]
struct MyStruct
{
[FieldOffset(0)]
public int i;
[FieldOffset(0)]
public byte[] o;
}
now if you set:
x.i = 0x4899;
then you'd be able to access data from any address.
I don't know if peverify can check those.
|
|
|
|
|
The CLR will not allow object references to overlap value types using FieldOffset, but it will allow object references to overlap other object references.
But I think I just answered my own question. Changing the security permission set to require assembly verification causes the runtime to throw an exception when it tries to load the MyStruct type.
Could not load type 'StructLayout.MyStruct' from assembly 'StructLayout, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because objects overlapped at offset 4 and the assembly must be verifiable.
So it looks like the runtime only allows you to do this only if you already had the proper security permission set to execute unsafe code to begin with, which I think should be fine. Still somewhat strange that the peverify utility says that the assembly is verifiable, though.
|
|
|
|
|
I have a listbox I am trying to show the process information in. I'm attempting to fill the listbox dynamically via a new thread as the code below shows.
private void Form1_Load(object sender, EventArgs e)
{
new Thread(new ThreadStart(UpdateProcessList)).Start();
}
private void UpdateProcessList()
{
Process[] OldProcesses = new Process[1];
Process[] NewProcesses = Process.GetProcesses();
while (p_DemoClosing == false)
{
if (OldProcesses.Equals(NewProcesses) == false)
{
ProcessList.BeginInvoke((MethodInvoker)delegate
{
ProcessList.Items.Clear();
});
NewProcesses = Process.GetProcesses();
foreach (Process DisplayProcess in NewProcesses)
{
ProcessList.BeginInvoke((MethodInvoker)delegate
{
ProcessList.Items.Add(DisplayProcess.ProcessName);
});
}
OldProcesses = NewProcesses;
}
Thread.Sleep(50);
}
}
Everytime the script runs no matter what I do all the .ProccessName's say idle rather than displaying the actual name. Once I attempt to get the processes IE for the first display they all come up with a processname of "Idle".
|
|
|
|
|
'twould seem to me it is getting a process name, System Idle Process, shows up as just 'idle'
I don't know why, i also don't know why every process would have this name... hmm
Okay, now its wierd, i copy your code, and implement it, the first 4 processes all come up right, then all others list as Idle...
And now all list as Idle
-- modified at 20:14 Wednesday 18th October, 2006
|
|
|
|
|
Boo-ya! >_<
I tried it with just invoke (not begininvoke) and it works fine, so i think, hmm perhaps we need EndInvoke (well, it would make sense)
so you need to do it like this:
IAsyncResult AR = ProcessList.BeginInvoke((MethodInvoker)delegate<br />
{<br />
ProcessList.Items.Add(DisplayProcess.ProcessName);<br />
});<br />
<br />
ProcessList.EndInvoke(AR)
Well, my lame theory is:
Since you don't end the invoke, it just the listbox (or listview) just keeps updating with the last thing that was sent by ProcessList.BeginInvoke - which would be the process 'Idle' (previously noted as being 'System Idle Process')
|
|
|
|
|
Ok that makes sense. I was under the assumption that once the code block for the delegate executed that the BeginInvoke would terminate itself. Seems like common sense, but then again there must be another reason behind it all.
|
|
|
|
|
v9ExportPacket p = new v9ExportPacket();
p.TemplateRecord = new TemplateRecord[5];
TemplateRecord t_tmp = new TemplateRecord();
t_tmp.FlowSetID=0;
t_tmp.Length=10;
t_tmp.id=23;
t_tmp.FieldCount=4;
t_tmp.Fields= new FieldPairs[t_tmp.FieldCount];
t_tmp.Fields[0] = new FieldPairs(1,2);
t_tmp.Fields[1] = new FieldPairs(3,4);
t_tmp.Fields[2] = new FieldPairs(5,6);
t_tmp.Fields[3] = new FieldPairs(7,8);
p.TemplateRecord[0] = t_tmp;
i was wondering if there is a way that i could just use
p.TemplateRecord[0].id=1;
instead of having to create a TemplateRecord object t_tmp to set the properties of that class and then set the TemplateRecord[0] property object equal to t_tmp object. i have looked into using indexers but i haven't seen an example where you could access a property of an indexed property.
|
|
|
|
|
If you create an indexer and the object is a class, it's passed by reference, so you can automatically alter indexed properties.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|