|
I think you've removed from concerts DatTable, not table in your DataSet. Use Remove method for concertDataSet1.Tables["Concert"].Rows .
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
See DateTimePicker.CustomFormat Property .
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
thnx
i have done it myself
i haveplaced 00:00:00 in the customformat instead of HH:mm:ss so i rote it here as a query
sukanya
|
|
|
|
|
HI
I have a datetimepicker contorl on a windows form which i have sent it to the time in the format property. it is in 12 hrs format i want to appear in 24 hrs format
Is there any way to do that?
Sukanya
|
|
|
|
|
EDIT: This problem is solved!
I'm building an application partly in C# (which I am learning currently) and the other part in C++.
What I want to do is pass a string or array of char's form my C++ dll to my C# exe. I seem to be able to pass basic data types, but when it comes to pointers or Strings or anything else, it either doest work, or my heap gets messed up or overwritten.
here is what I have in my C++ project
EXPORT void TestFunc(char* str)
{
str = ptr;
}
here is the C# stuff
[DllImport("My_C_PlusPlus.dll")]
public static extern void TestFunc( [MarshalA(UnmanagedType.LPTStr)] StringBuilder str);
StringBuilder temp = new StringBuilder(128);
TestFunc(temp);
and temp ends up NOT being correct;
But I tried this too
C++..
EXPORT char* TestFunc()
{
return ptr
}
C#...
String temp = TestFunc();
temp ends up being correct weather it’s a String or StringBuiler, but then my heap for my c++ dll gets jacked. I get an int 3 (user defined break) right away upon returning that function;
I also tried just using a char* in my C# project and assigning upon return from the dll function call but that didn’t work at all, the value ended up being all message. The problem is, one project thinks is some datatype and the other thinks its something else, so it never works. Is there some sort of unified data type for strings or pointers to strings that I can use here?
|
|
|
|
|
I tried it with LPTSTR in my dll with no luck either.
|
|
|
|
|
WHOA! figured it out
enough guessing and checking seemed to work, lol
inside the DLL: (C++)
EXPORT void MyFunc(LPTSTR pString)
{
strcpy(pString,"text");
}
inside the exe: (C#)
[DllImport("mydll.dll")]
public static extern void MyFunc( [MarshalAs(UnmanagedType.LPStr)] StringBuilder str);
StringBuilder temp = new StringBuilder(128);
What my problem was was, i was trying to use the string inside the c# project as a pointer to point to the stuff in the dll, but what i needed to do was pass a pointer to memory inside the exe to the dll and have it assign stuff there. No pointers in C# is kinda awkward for me as a (7+ years C++ coder)
anyway, im talking to myself, good night
|
|
|
|
|
Hey guys,
I'm so sorry because this is probably one of the most stupid questions I ever asked, but hey, I once was a VB programmer and now started C#, you should be happy hearing that
Now what's happening, I'm creating a databound control in C# which uses an Sql connection in order to fetch it's data. To establish the connection we need a connection string, and so I check for the existance of if. When the connectionstring property was not set, I want to throw an exception telling the user that the connectionstring was not set.
throw new SqlException("Connectionstring not set");
Now when compiling I get the warning
No overload for method 'SqlException' takes '1' arguments
I cannot find what's really meant here, and how to solve it... Any ideas?
I love it when a plan comes together
|
|
|
|
|
It means that the SqlException class provides no constructor that takes 1 argument, in your case the error message.
Taking a quick look at MSDN shows that the SqlException class provides no constructor at all, so you'll have to throw some other exception. Unless, someone knows a workaround.
www.troschuetz.de
|
|
|
|
|
Stefan Troschütz wrote:
Unless, someone knows a workaround
A workaround to a no-public-constructor object?!?!?
I guess you could instantiate through reflection if you were THAT desperate to have a SqlException.
|
|
|
|
|
Yup, I guess that should be it... Throwing an ArgumentException in case of an SqlException solves the problem.
I love it when a plan comes together
|
|
|
|
|
nikneem2005 wrote:
I cannot find what's really meant here
Sorry to state the obvious, but what is really meant is what it really says. The "Method" you are calling is actually a constructor (similar in signiture to a method). As the error states, there is no constructor which takes one parameter (argument).
You can confirm this by opening object browser in VS, navigating to system.data.sqlclient.SqlException - it has NO public constructors at all. The most likely reason for this is that SqlException was not intended to be used by client code. A quick look with .NET reflector confirms there is a serialization constructor on this object only.
Now, to answer your question, create your own exception, inheriting from System.ApplicationException, and throw this instead. Something like "ConfigurationException" would be relevant in this case and could be reused anytime where the app is not configured correctly.
|
|
|
|
|
I have created windows control library and accessing it thru internet explorer.
when i try to read xml file over the web i get a security error.
What could be the reason ?
I have set an evidence and permssion set (FileIo , execution permission) for the dll that will be accessed over the web.
And this dll in turn used in html page using
<object id="digitalReview" height="500" width="275" classid="http://localhost/CtrlLib/ControlLibrary.dll#ControlLibrary.DigitalControl" name="ucl" viewastext="">
<param name="VirtualPath" value="" />
My problem is :
I have one function called getXmlData() in the dll, which reads xml file.
http://localhost/triqweb/config/config.xml. But when I try to access getXmlData function, IE throws up a security error ?? What permission should I need to set to access the xml file. Please help.
- Sreenath
|
|
|
|
|
Hi Gurus,
I have a doubt regarding using connection pooling in my Windows.net application. Our application has around 30+ simultaneous users connecting to the database(Oracle), but the application is running on individual machines using the that machine resource. Any connection requests are made to the Database from the individual systems.If I pool the connection, is there any performance advantage?
Thanks in advance
Sapna
|
|
|
|
|
Definitely it has..
Try to use a singleton class for the connection.
I am not sure in oracle, but you can set maxpool and minpool size in connection string
--- boarders may have better idea.
Sreenath
|
|
|
|
|
How can I capture a video stream using C# and DirectX. Is there any other option available apart from directX.
And after capturing the video, I want to separate the frames of the captured video. Can someone guide me.
|
|
|
|
|
i had one class derived from ServicedComponent,let say ClassA, to return registry key values reside at the server machine. ClassA compile as dll and place in server machine, regsvcs and gacutil done in server.
then i got one client app project, which add reference to the ClassA.dll and call the ClassA's method to get the settings value. But the settings value that i get is not from the server (let say my client also got same settings key which value is different from server).
my question is why the ClassA object that created, although is transparent_proxy, is not at the server side process instead it is client side process? and how to make the ClassA as a server process object?
Thanks in advance
Mr. New
|
|
|
|
|
Hi friends,
I need validate the username and the password on the local machine. When I run my application a login screen pops up user enters the Username password. If these credentails are valid for the system I should the user to continue.
Can any one please help me
|
|
|
|
|
Disable Integrated windows authentication...
Disable Anonymous access .. these setting should be done for the virtual directory. In addition to the above modify authorization section in the web.config file have the following element
<deny users="?" />
Create WindowsPrincipal object by using Thread.CurrentPrincipal
From WindowsPrincipal get the WindowsIdentity object
WindowsIdentity have the IsAuthenticated method which say whether the user has authenticated (authentication done twice)
You will get several properties/ methods in windowsindentity object for accessing the user's credentials like username etc.,
|
|
|
|
|
Hi sreenath,
Thanks for the suggesstion
I need to get the password also authenticated as i need to provide it for one of the service which my application using. I have set the option "This accont" in the log on tab of the services.msc dialog. If I dont select this option and provide the currently logged in username and password service will not run properly.
Is there any other alternate option of setting the currently logged in username and the password to the service.
As I new can u please help me out.
|
|
|
|
|
The service is runs independant of the user that's logged in. Of course, it too needs an account to run under, be it a user account created for the purpose or the System account. Your service CANNOT change the account it's running under without first being stopped, change the account information in the Service Control Manager, and then restart the service.
But, I suspect this is not what you want to do. Your service apparently has to pass credentials along to some other process to do work for the logged in user perhaps? Then your service will have to be rewritten to handle the notifications of a user logging on and off and be able to have another application send it a username and password to use.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello,
This is a tough question that's driving me nuts. I have a stored procedure that returns three tables, which I store in a DataSet . The records in one of the tables (table 1, also contains a JOIN ) contain foreing keys from the other two tables.
My UI (a dialog box) lets the user add, edit and remove records in the three tables. He can even add a record in the first table with the foreign keys of the recently added records in tables 2 and 3.
The PK for all three tables are autogenerated (identity), and in the DataSet they are negative values (so they don't collide with the real values in the database.)
My question is, how do I call DataAdapter.Update to save all the changes to the database? It's not that easy because:
* The records in table 1 may contain references to records in the other two tables, whose PK are negative values. The references in table 1 must be updated to the actual values given in the database.
* Table 1 contains a JOIN , but also the PK from the joined table (other that these three) so it shouldn't be a problem, if I can manually update without including that column.
* Different tables, different commands to update. The data adapter only lets me specify one update, insert, and delete command; and here it must be different for each table.
Is there a "simple" way to do it? or should I go through all the changes and do the updates manually? is it a lot of work?
Thanks in advance for any help,
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I create a very simple helloworld webservice using vs.net (let us call it myservice.asmx).I browse to the correspnoding wsdl - http://localhost/Myservice/myservice.asmx?wsdl;and save the generated wsdl to disk after removing the service element.
Now i intend to use the wsdl for generating another service.So I use the vs.net command prompt.
wsdl /server http://localhost/Myservice/myservicewsdl.wsdl /l:CS /out:InheritedService.cs
This gives me the error
Error: Unable to import binding 'MyServiceSoap' from namespace 'http://tempuri.org/'.
- Unable to import operation 'HelloWorld'.
- Specified cast is not valid.
So I separate out the types into a separate schema
My schema(testWSDLInheritanceTypes.xsd)
========
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:tns="http://jpnws0t1/SchemaWSDL" elementFormDefault="qualified" targetNamespace="http://jpnws0t1/SchemaWSDL" id="DataSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="HelloWorld">
<xs:complexType />
</xs:element>
<xs:element name="HelloWorldResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="HelloWorldResult" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
And the wsdl
=========
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:i1="http://jpnws0t1/SchemaWSDL"
xmlns:tns="http://jpnws0t1/SchemaValidatedService"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://jpnws0t1/SchemaValidatedService"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<import namespace="http://jpnws0t1/SchemaWSDL" location="testWSDLInheritanceTypes.xsd" />
<types />
</definitions
On using wsdl.exe on this file,I do not get any errors but a very helpful warning:no classes were generated.
How do I proceed to generate code?
|
|
|
|
|
if I declare a variable in a try block
<br />
try<br />
{<br />
XmlDocument configDoc = new XmlDocument();<br />
configDoc.Load(@"..\..\katalog.config");<br />
}<br />
How could I access it later on in the finally block?
<br />
finally<br />
{<br />
<br />
XmlNodeList categories = configDoc.SelectNodes(<br />
"/configuration/categories/category");<br />
XmlNodeList disks = configDoc.SelectNodes(<br />
"/configuration/disk_numbers/disk");<br />
<br />
RepositoryItemComboBox ProgramCategoryComboBoxEditProperties = <br />
programCategoryComboBoxEdit.Properties;<br />
ProgramCategoryComboBoxEditProperties.TextEditStyle = <br />
DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;<br />
<br />
RepositoryItemComboBox DiskNumberComboBoxEditProperties = <br />
diskNumberComboBoxEdit.Properties;<br />
DiskNumberComboBoxEditProperties.TextEditStyle = <br />
DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;<br />
<br />
foreach(XmlNode SingleCategory in categories)<br />
{<br />
ProgramCategoryComboBoxEditProperties.Items.Add(SingleCategory.InnerText);<br />
}<br />
foreach(XmlNode SingleDisk in disks)<br />
{<br />
DiskNumberComboBoxEditProperties.Items.Add(SingleDisk.InnerText);<br />
} <br />
}<br />
|
|
|
|
|
You can't access a variable declared in one block from another block. Declare the variable outside of the try block but assign it inside the block:
SqlConnection conn = null;
try
{
conn = new SqlConnection(connectionString);
}
finally
{
if (conn != null) conn.Dispose();
} BTW, this is actually what the following declaration resolves to when the class implements IDisposable :
using (SqlConnection conn = new SqlConnection(connectionString))
{
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|