|
Rock out! I changed it up to
Dim str As String = Encoding.Unicode.GetString(reader(0))
and it works!
On a side note, I DID scour the MSDN articles, CodeProject, and Google but never found what i was looking for. This is more than likely because i am not sure what topic i would need. Knowing where i fell down, any suggestions on topics to read up on?
THANKS A MILLION!
|
|
|
|
|
Well, that's the hardest part about learning the .NET Framework. It's massive collection of thousands of classes, containing tens-of-thousands of methods and properties. It involves LOTS of reading and experimentation.
About 6 years ago, when I got my hands on the Beta for .NET 1.0, I started by reading whatever documentation I could find in the MSDN Library, evaluating which namespaces were going to help me the fastest and built from there.
Today, I probably suggest picking up a beginners book on VB.NET and start reading through the clas documentation in the following namespaces:
System.Collections
System.Data (stick to OleDb for now)
System.IO (just the root, not the child namespaces under it!)
System.Text
System.Windows.Forms (just the root, not the child namespaces under it!)
Then start adding other stuff like System.Xml and System.Runtime.Serialization.
|
|
|
|
|
I seem to have run into a second problem that seems to be related. For my sample data, I have
"
hello!
GOODBYE!
hello!
GOODBYE!
BONJOUR!
HALLO!
NOWAY!
"
in the cell that i am pulling from with your code. When i run it, i only get this much:
"
hello!<cr><lf>
GOODBYE!<cr><lf>
hello!<cr><lf>
GOODBYE!<cr><lf>
BONJOUR!<cr><lf>
HALL
"
As you can see, there is some missing text (O!<cr><lf>NOWAY!).
Could this be related to Encoding.Unicode.GetString(reader(0))?
I am storing the result in a string so I do not think that it is getting chopped on that end.
The While reader.Read() does not execute a second time (my first thought was that there was a limit to how much it could take).
If you have the time or the patience, your help would be greatly appreciated.
-Steve
|
|
|
|
|
It's possible. Two 0x00 characters in a row would normally denote the end of a string.
Why are you using a binary data type for storing string data?
I really can't tell you what's wrong. There's a bunch of different places this can fail, such as what the code looks like that stored the data, if the data get stored properly, if the encoding is consistent throughout the data, ...
|
|
|
|
|
I found a fix for it. I changed from using System.Data.ODBC to System.Data.SQLClient. That does not limit me at all.
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
myConnection = New SqlConnection("server=" + Server + ";uid=" + Username + ";pwd=" + Password + ";database=" + DB + ";Trusted_Connection=yes;")
'establishing connection. you need to provide password for sql server
Try
myConnection.Open()
'opening the connection
myCommand = New SqlCommand("SELECT *FROM MYTABLE WHERE MYID='" + MYTHING.ToString + "'", myConnection)
Dim dr As SqlDataReader = myCommand.ExecuteReader()
While dr.Read()
'mystr = dr.GetString(0)
'reading from the datareader
MsgBox(Encoding.Unicode.GetCharCount(dr(0)))
mystr = Encoding.Unicode.GetString(dr(0))
MsgBox(mystr)
'displaying data from the table
End While
dr.Close()
myConnection.Close()
Catch
End Try
|
|
|
|
|
Does anyone know how to do the following:
If listbox2 contains recycle.wav do not add recycle.wav to listbox1.
|
|
|
|
|
Why not just enumerate the items in the ListBox, comparing the one your searching for to the items in the list?? If you find it, don't add it to ListBox2.
|
|
|
|
|
Hey,
I'm trying to use the DoCmd.SendObject to send an email. The last paramater, it asks for a template file. If I have an .oft (Outlook File Template) saved, can I just put the path into there? I've tried just putting the path in as a string and it doesn't open up the template file. Can anyone please help me out with this?
|
|
|
|
|
Hi all,
I am developing a windows application in VB.Net.
I am using datagrid with direct editing option.
In datagrid, when editing any particular cell, the arrow pointing towards to the edited row in the left side changes to edit mode , i.e., it displays like a pen.
At this time when I change, edited record is not updated.
What event fires when editing a datagrid cell?
Thanks in advance,
Senthil
|
|
|
|
|
Senthil_GeoEdge wrote: At this time when I change, edited record is not updated
What do yot mean by this? Are you saying that you can't change the data in the datagrid or you can't update the data in the database? How are you triggering the code to save the new data? What does the code look like that does the database access?
|
|
|
|
|
I have my project on network which having windows2000 server.
I make a connection in my project.
when i run it without copying it to local machine i get error message,it shows some permission problem.but when i copy same project to my local machine which having xp it give output
my local machine have all the rights for database.i used sql server 2005 and vs 2005.
|
|
|
|
|
So if I get this right...
Ajeet mittal wrote: my local machine have all the rights for database
so your local machine has permissions but the other doesn't.
Ajeet mittal wrote: when i run it without copying it to local machine i get error message,it shows some permission problem
When you run it on the other machine it says you don't have permission.
Ajeet mittal wrote: but when i copy same project to my local machine which having xp it give output
But when you run it on your machine it works fine.
Could it be that it works fine because your machine has permission and the other doesn't?
|
|
|
|
|
Ajeet mittal wrote: I make a connection in my project.
Connection? To what? What code did you use? What's the connection string you used if this is a database? Is this SQL Server 2005 Express Edition?
Ajeet mittal wrote: when i run it without copying it to local machine
Copying WHAT to the local machine?
Ajeet mittal wrote: i get error message
And that would be??? Without knowing this, we're all just wasting our time...
Ajeet mittal wrote: but when i copy same project to my local machine
You already said you did this and it failed! So, which is it?? Did the project work on the local machine and fail when you copied it to another computer??
|
|
|
|
|
|
Sir,
I make connection with the statement-
dim con as new sqlconnection("Servername with database and uid ,pwd")
I am using sqlexpress edition.also
when i execute my project after coyping complete project to any local machine from server it gives my form without error and if i try to execute same project on the server location it gives permission error.
i also copy bin folder to server from local machine to server location and try to execute it from there,i means to say i try to run exe from server its shows permission error.As this having compiled code.
tell me solution what i have to do for it.
ajeet
|
|
|
|
|
Right, did you read my reply to your original post?
If it's giving you a permissions error its to do with the permissions ... it's pretty easy to work out.
|
|
|
|
|
Ok! So whats your connection string like? By default, SQL 2005 Exp. Ed. only has SM enabled. If you want to use TCP/IP or named pipes, you need to turn it on using the SQL Server Configuration Manager.
My guess is that this all will go over your head. But let me put it this way.
1) You cannot remotely connect to SQL Server Express by default. You need to configure it to accept rmote connections.
2) If your connection string resembles something like this
Data Source=.\SQLEXPRESS;AttachDbFileName=e:\data\aaa.mdf;Integrated Security=True;User Instance=True
Then you're using shared memory to access it.
3) If the above is true, you need to copy the DB file to the "other" machine as well, and I guess it also should have Express Edition installed.
(Or)
If you want to enable remote connections, change your server configuration using the server manager and change your connection string. And that would seem pretty complicated if you do not know what you're doing.
So for a start, start reading the Express Edition documentation.
SG
|
|
|
|
|
And on top of what Simulation said, if you copied the code to a file share and are running the code from that share, you need to take into consideration Code Access Security. Managed code running from ANY non-local source (i.e.: network) runs in a restricted sandbox. If I understand your explaination correctly, this is probably where your "Security Exception" is comming from.
Bascially, the users machine doesn't trust your code. You have to tell it to trust the code. Read[^].
|
|
|
|
|
I'm trying to make windows local users with VB. This is no problem. I'm stuck trying to set the environment settings for that local user. For starting after sign on with RDP. Is this possible anyway? Maybe somebody can put on the right direction.
|
|
|
|
|
When I migrated my app, which has worked fine on many machines, to a new one, it didn't run. I would see the hourglass for a second, then nothing.
So I installed VS on that machine and compiled the program.
The debugger does the same thing... just stops. However, sometimes, when it is trying to display a simple message box it gives me:
System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
I have no idea how to deal with this error.
thank you.
|
|
|
|
|
There seems to be as many different causes as there are reports of this kind of problem. About the only thing you can do is start going down the list[^] and checking out possibilities.
|
|
|
|
|
Are you doing anything with Office in your application? I received the same error message on my development machine after I installed Outlook 2003 and and leaving Office 2002 installed. It turns out this error was caused by different versions of the Office Assistant being installed on the machine. In which case I disabled the office assistant for Office 2002. Don't know if this helps, but just trying to share my experience.
Mike Lasseter
|
|
|
|
|
Hi! All,
Can anybody tell me how to check the availability of a database connection in VB?
Thanks and Regards,
virendra
|
|
|
|
|
hi virendra,
if you have created the recordset then check for
recordset.state property
if
recordset.state = 1 then connection is open
and if it is '0' then connection is close
best regards,
koolprasd2003
Be A Good S/W Eng... Life is swing with you..Enjoy..
|
|
|
|
|
Hi,
I think you mean <connection object="">.State property.
For eg:-
dim adocn as new ADODB.Connection
Then we can check whether connection is open or not by adocn.State
|
|
|
|