You're right, what a stupidy of mine.
This is the correct code:
But now I've go the problem that the returning strings a filled with '\0' behind the text when the given length is greater than the actual length.Code:[ DllImport( "..\\mydll.dll", CharSet=CharSet.Unicode ) ] internal static extern bool GetDatabaseInfo( uint uiBuffCnt, string sDataSource, string sCatalog, string sUsername, string sPassword ); //---------------------------------------------------------------------- private void Page_Load(object sender, System.EventArgs e) { string sDataSource = new string( ' ', 1024 ); string sCatalog = new string( ' ', 1024 ); string sUsername = new string( ' ', 1024 ); string sPassword = new string( ' ', 1024 ); try { //sDataSource = sCatalog = sUsername = sPassword = ""; GetDatabaseInfo( 1024, m_sDataSource,m_sCatalog,m_sUsername,m_sPassword ); }
Now i want to trime the returning string to a fitting size. How can I do that?
Thanks in Advance
Akademos




Reply With Quote