Click here to Skip to main content
16,012,352 members
Home / Discussions / Database
   

Database

 
Questioncopy db diagrams from one sql server to another? Pin
Roger Alsing14-Sep-04 21:42
Roger Alsing14-Sep-04 21:42 
AnswerRe: copy db diagrams from one sql server to another? Pin
Totoo15-Sep-04 9:50
Totoo15-Sep-04 9:50 
GeneralVarbinary field comparisons Pin
cpritt14-Sep-04 8:29
cpritt14-Sep-04 8:29 
GeneralRe: Varbinary field comparisons Pin
Jon Rista14-Sep-04 8:44
Jon Rista14-Sep-04 8:44 
GeneralRe: Varbinary field comparisons Pin
cpritt14-Sep-04 9:52
cpritt14-Sep-04 9:52 
GeneralRe: Varbinary field comparisons Pin
Jon Rista14-Sep-04 13:17
Jon Rista14-Sep-04 13:17 
GeneralRe: Varbinary field comparisons Pin
cpritt14-Sep-04 18:57
cpritt14-Sep-04 18:57 
GeneralRe: Varbinary field comparisons Pin
Jon Rista15-Sep-04 7:16
Jon Rista15-Sep-04 7:16 
Well, lets see what we can do here. It seems its not possible to have ADO.NET automatically cast a varbinary to a string. So, what we need to do is find a way to manually cast it ourselvs.

I think there are several ways of doing this. So, after a few minutes research, here are the best options I came up with.

Try using my_Reader.GetSqlBinary(). From this SqlBinary object, call sqlBinary.ToString() to convert the value to a string. I'm not certain if it will convert byte by byte or if it will just do something similar to calling Encoding.ASCII.GetString(byte[]).

If calling ToString doesn't work right, you could try calling sqlBinary.ToSqlGuid(), then call sqlGuid.ToString(). You should only do this if the binary data being returned is 128 bits, or 16 bytes, long.

If the data is not 16 bytes long, and calling GetSqlBinary doesn't result in useful data, I'd manually build a string from your byte array. Something like:

byte[] binary = my_Reader.GetSqlBinary().Value;
string binStr = "";
for (int i=0; i
GeneralRe: Varbinary field comparisons Pin
cpritt15-Sep-04 8:54
cpritt15-Sep-04 8:54 
GeneralRe: Varbinary field comparisons Pin
Jon Rista30-Sep-04 18:52
Jon Rista30-Sep-04 18:52 
GeneralExtreme performance issues (SQL Server 2000/ADO.NET/C#) Pin
Jon Rista14-Sep-04 8:14
Jon Rista14-Sep-04 8:14 
GeneralRe: Extreme performance issues (SQL Server 2000/ADO.NET/C#) Pin
Steven Campbell14-Sep-04 9:34
Steven Campbell14-Sep-04 9:34 
GeneralRe: Extreme performance issues (SQL Server 2000/ADO.NET/C#) Pin
Steven Campbell14-Sep-04 9:35
Steven Campbell14-Sep-04 9:35 
GeneralRe: Extreme performance issues (SQL Server 2000/ADO.NET/C#) Pin
Jon Rista14-Sep-04 13:13
Jon Rista14-Sep-04 13:13 
GeneralRe: Extreme performance issues (SQL Server 2000/ADO.NET/C#) Pin
Steven Campbell14-Sep-04 14:08
Steven Campbell14-Sep-04 14:08 
GeneralRe: Extreme performance issues (SQL Server 2000/ADO.NET/C#) Pin
Jon Rista14-Sep-04 14:26
Jon Rista14-Sep-04 14:26 
GeneralWorking with a database Pin
Britnt714-Sep-04 2:17
Britnt714-Sep-04 2:17 
QuestionHow to display message when record is not found? Pin
DotNet13-Sep-04 23:00
DotNet13-Sep-04 23:00 
AnswerRe: How to display message when record is not found? Pin
Colin Angus Mackay14-Sep-04 2:52
Colin Angus Mackay14-Sep-04 2:52 
GeneralRe: How to display message when record is not found? Pin
DotNet14-Sep-04 2:59
DotNet14-Sep-04 2:59 
GeneralRe: How to display message when record is not found? Pin
Steven Campbell14-Sep-04 4:35
Steven Campbell14-Sep-04 4:35 
GeneralRe: How to display message when record is not found? Pin
DotNet14-Sep-04 4:56
DotNet14-Sep-04 4:56 
GeneralSQL Server/Access Import Issue Pin
Ossmer13-Sep-04 21:45
Ossmer13-Sep-04 21:45 
GeneralNew data row in data set- without disturbing IIS ! Pin
aBaste13-Sep-04 20:58
aBaste13-Sep-04 20:58 
GeneralRe: New data row in data set- without disturbing IIS ! Pin
Steven Campbell14-Sep-04 8:13
Steven Campbell14-Sep-04 8:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.