|
We want to retrieve data from a Navision 3.70 C/Side database using .NET. We managed to create a DSN and retrieve data from the Navision database by using Excel or MSQuery.
When i try to read data from my .NET application using the same DSN i get an error:
ERROR[IM001][Microsoft][ODBC Driver Manager]Driver does not support this function
.NET code (C#)
=============
OdbcConnection conODBC = new OdbcConnection(“DSN=Sample C/ODBC 32 bit”);
conODBC.Open();
DataTable dt=new DataTable();
OdbcDataAdapter da = new OdbcDataAdapter("SELECT * FROM Klant", conODBC);
da.Fill(dt);
============================================================================
The first two lines successfully connect to the Navision database (which is specified in the DSN).
The last two lines should retrieve data from the database but instead they give the error.
Can anyone help?
|
|
|
|
|
Maybe the ODBC driver does not support ado.net provider.
Try the higher version of ODBC driver.
best regards
Samuel
|
|
|
|
|
From my C# client,I try to plug in a custom provider,through a configuration file
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="http">
<clientProviders>
<formatter ref="soap" />
<provider type="CustSinkProviderLib.CustSinkProvider, CustSinkProviderLib"
customSinkType="CustProviderLib.CustomSink, CustProviderLib" />
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
However I get a remoting error with the following stack
Additional information: Remoting configuration failed with the exception System.Runtime.Remoting.RemotingException: Cannot load type CustSinkProviderLib.CustSinkProvider, CustSinkProviderLib.
at System.Runtime.Remoting.RemotingConfigInfo.LoadType(String typeName, String assemblyName)
at System.Runtime.Remoting.RemotingConfigHandler.CreateChannelSinkProvider(SinkProviderEntry entry, Boolean bServer)
at System.Runtime.Remoting.RemotingConfigHandler.CreateClientChannelSinkProviderChain(ArrayList entries)
at System.Runtime.Remoting.RemotingConfigHandler.CreateChannelFromConfigEntry(ChannelEntry entry)
at System.Runtime.Remoting.RemotingConfigHandler.ConfigureChannels(RemotingXmlConfigFileData configData)
at System.Runtime.Remoting.RemotingConfigHandler.ConfigureRemoting(RemotingXmlConfigFileData configData).
Since it is difficult to find out the cause,I wish to do the same through code.
Can someone provide a sample code of how to invoke the provider and custom sink through code,rather than config file?
|
|
|
|
|
The cause should actually be pretty obvious: the type cannot be loaded. Either the assembly containing it (CustSinkProviderLib) cannot be found or the Type in that assembly doesn't exist (perhaps an older assembly is being used, for example).
The assemblies must be resolvable. See How the Runtime Locates Assemblies[^] in the .NET Framework SDK for more information.
Also, this assembly would need to be resolvable on both the client and server.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi, I would like to know if String Class provides a method to print hex value on a MessageBox... I would like to print CRC file, saved in a ulong variable in my old C written code... using String.ToString prints decimal value..... any way to change it?? thanks
Paolo
|
|
|
|
|
Yeah, change the method call in .ToString() to .ToString("X"). This will format the output as Hex. This will only work if your converting a numeric value to a string. If your try this on a String object, it won't work. You have to convert the string value back to a number, then use the format "X" in the .ToString method.
RageInTheMachine9532
|
|
|
|
|
Actually, you should use Byte.ToString("x2") , or use String.Format("{0:x2}", someByte) or something like that. Without the "2", you'd get an invalid representation of bytes with values less than 127.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Just open browseui.dll from %WINDIR%\System32 in Visual Studio .NET. Expand the Bitmap resource section and find the image strip you want. You can export that and then load it using ImageList.Images.AddStrip , or break-up the images into squares and add them individually.
Legally, you're not supposed to do this and just use the older images in the Common7\Graphics directory of your Visual Studio .NET installation, but only commercial products would probably suffer any consequences. I have been talking to Microsoft about updating those images since they're grossly out-dated.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
As I mentioned, you're not supposed to, but even non-Microsoft MSDN authors use them for articles posted on MSDN. So long as certain trademark images are used inappropriately, I can't see how a final year project would be affected. Take it up with your advisor to be sure if you're concerned.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
When I Build i try to load a project document I get the following message:
An error occured while loading the document. Fix the error, then try loading the document again. The error message follows:
The designer could not be shown for this file because none of the classeswithin it can be designed. The designer inspected the following classes in the file:
PrinterGUI2D--The base class 'RL.NDM.NDMUI.HostGUI2D' could nt be loaded. Ensure the assembly has been referenced or built if it is part of the project.
What d you advice. Below is file PrinterGUI2D.cs
namespace RL.NDM.NDMUI {
using System;
using System.Collections;
using System.Core;
using System.ComponentModel;
using System.Drawing;
using System.Diagnostics;
using RL.NDM;
using System.Windows.Forms;
///
/// A PrinterGUI2D is an extension of a HostGUI2D, with graphics customised for a printer
///
public class PrinterGUI2D : HostGUI2D {
private System.ComponentModel.IContainer components;
public PrinterGUI2D() : base() {
InitializeComponent();
}
public PrinterGUI2D(Host objHost) : base(objHost) {
// This call is required by the Windows Form Designer.
InitializeComponent();
}
// Form overrides dispose to clean up the component list.
public override void Dispose() {
base.Dispose();
components.Dispose();
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager (typeof(PrinterGUI2D));
this.components = new System.ComponentModel.Container ();
//@this.TrayLargeIcon = false;
//@this.TrayAutoArrange = true;
//@this.TrayHeight = 90;
lblHostname.Visible = true;
picIcon.Visible = true;
picIcon.Image = (System.Drawing.Image) resources.GetObject ("picIcon.Image");
ilstImages.ImageStream = (System.Windows.Forms.ImageListStreamer) resources.GetObject ("ilstImages.ImageStream");
}
public override void Refresh() {
base.Refresh();
}
}
}
|
|
|
|
|
As the error says, you must reference the assembly containing that control/component in your project. Right-click on your project and select "Add Reference...". Select or browse to your assembly, add it to the list, and click OK.
At runtime, this assembly must also be resolvable, so it must be in your application directory, a probing path (configured in the .config file), referenced in the assemblyBinding section of your .config file, or, optimally, in the Global Assembly Cache (GAC). See How the Runtime Locates Assemblies[^] in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello...
For the moment I use something like "dataRow.ItemArray.GetValue(4).ToString();" to get the value of the 5th attribute in a DataRow of a DataGrid.
I don't seem to find a way to get the 5th value with the column name. Let's say the 5th attribute is in the column with name "Amount". How do I get this value out of the DataGrid.
Can someone help me out?
Thx in advance!
TweeZz.
|
|
|
|
|
dataRow["Amount"].ToString();
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Omg... It's that simple... I'm ashamed :s
Thx for the help Stewart (again)!
|
|
|
|
|
Hello!
How do I set the connection timeout in C#? It is default 15 sec, I want 90. I'm connecting to a sql-database.
|
|
|
|
|
Set the Connection Timeout property in the connection string, or use the ConnectionTimeout property on the SqlConnection object.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
i am developin a voice enabled application and in which the IDe is controlled by voice commands..ex if i say "file" then file menu should be dropped..i can catch the commands but having problems in droppin the menu..
This can be jotted down to a simple problem like if u click a button in ur form..then file menu should be dropped..
i am doin this project using window forms in C#..
please help me out as soon as possible...
mail me at harbhanu@rediffmail.com
harbhanu@hotmail.com
|
|
|
|
|
Why don't you use TrackPopupMenu?
Declare the good old method:
[System.Runtime.InteropServices.DllImport("user32.dll")]<br />
private static extern bool TrackPopupMenuEx(IntPtr hmenu, int fuFlags, int x, int y, IntPtr hwnd, IntPtr lptpm);
Drop menus at anypoint:
<br />
public static void TrackPopupMenu(ContextMenu Menu, Point Location){<br />
TrackPopupMenu(Menu, (int)(TPM_LEFTBUTTON|TPM_LEFTALIGN|TPM_TOPALIGN), Location, new IntPtr(0));<br />
}
Or drop menus an other controls:
public static void TrackPopupMenu(ContextMenu Menu, Control DockingControl){<br />
Point menuPosition = DockingControl.PointToScreen(<br />
new Point(DockingControl.ClientRectangle.Location.X, DockingControl.ClientRectangle.Bottom) );<br />
TrackPopupMenu(Menu, (int)(TPM_LEFTBUTTON|TPM_LEFTALIGN|TPM_TOPALIGN), menuPosition, DockingControl.Handle);<br />
}
|
|
|
|
|
If you're using a ContextMenu , you can actually just call Show , which encapsulates the TrackPopupMenu API.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i have a function that populates a combobox from a database and returns a table that i set as the datasource for the combobox, then a user select a value and on the Selection change event i populate another combobox based on the selected value, but the first combobox needs to have blank text so as the user is fprced to select a value from the first combobox but as i am populating the first combobox in the windows form LOAD it show the text of the first record from the database ie the first row of the table returned how can i add a blank row to my table and still populate the first combobox??
|
|
|
|
|
After you assign the DataSource property, do something like:
comboBox1.Items.Insert(0, string.Empty);
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
a big thank you i will try after the easter break
|
|
|
|
|
private void LScheme()
{
Customer c = new DGIBO.Customer();
DataTable list = c.getSchemes();
ddlScheme.Items.Insert(0, string.Empty);
this.ddlScheme.DataSource = list;
this.ddlScheme.DisplayMember = "SchemeName";
this.ddlScheme.ValueMember = "PhaseName";
tried my example above and it does not work, tried putting your code after datasource and got an error because the databind
|
|
|
|