October 14, 2009 at 5:45 am
Hi,
One of our staff members is having trouble connecting to ANY of our servers, using SSMS.
All other users can connect. His login works from other machines.
I have tried my login on his machine, and then get the same error that he is getting, so there must be something on his computer blocking access to servers.
HERE is the error:
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The specified data could not be decrypted.
) (Microsoft SQL Server, Error: -2146893008)
Does anyone have any idea on how I can solve this issue?
Nothing has changed on his machine and he was able to connect until this morning, when the error started appearing.
October 14, 2009 at 6:49 am
if object_id('') is not null
drop procedure dbo.Usp_AddPhoto
go
create procedure dbo.Usp_AddPhoto
(
@p_StdID int,
@p_Photo image,
@p_output int output
)
as
begin
Declare @err int
begin tran
if exists(select 1 from tbl_Registration_Master where datalength(photo) =
datalength(@p_photo) or substring(photo, 1, 8000) = substring(@p_photo, 1, 8000))
begin
rollback tran
set @p_output=-1 --ur try to insert same photo
return
end
update tbl_Registration_master set Photo=@p_Photo where Student_ID=@p_StdID
select @err=@@error
if @err<>0
begin
rollback tran
set @p_output=@err
return
end
else
begin
commit tran
set @p_output=1
return
end
end
go
/*
----------------------------------
protected void // ERROR: Handles clauses are not supported in C#
bthExportTemplate_Click(object sender, System.EventArgs e)
{
try {
ImportBulkData = new Adomethods("SELECT top 0 *,'' AS Dummy FROM
VIW_EXPORT_UPLOAD_TEMPLATE", Session("ClientDBName")).DataSet();
DataRow newRow = ImportBulkData.Tables(0).NewRow();
for (int i = 0; i <= ImportBulkData.Tables(0).Columns.Count - 1; i++) {
// To add a dummy row in the export template which shows which field is
mandotory
// at the time of uploading the data
string STRING1 = ImportBulkData.Tables(0).Columns(i).ColumnName;
if (ImportBulkData.Tables(0).Columns(i).ColumnName == "CLIENT_ITEMNO") {
newRow(ImportBulkData.Tables(0).Columns(i).ColumnName) =
"MANDATORY".ToString;
}
else {
newRow(ImportBulkData.Tables(0).Columns(i).ColumnName) = "NON
MANDATORY".ToString;
}
}
ImportBulkData.Tables(0).Rows.InsertAt(newRow, 0);
ImportBulkData.AcceptChanges();
ValidateClass nameoffile = new ValidateClass();
string filename = nameoffile.filepath("ImportBulkData");
Export2Excel.Export(ImportBulkData, filename);
}
catch (Exception ex) {
StdLblErrMsg.Text = " Error in ExportTemplate:" + ex.Message + "";
}
}
--------------------------
public class Export2Excel
{
public static void Export(DataSet recordSet, string fileName,
[System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(true)] // ERROR: Optional
parameters aren't supported in C# bool ExportData)
{
try {
string C_HTTP_HEADER_CONTENT = "Content-Disposition";
string C_HTTP_ATTACHMENT = "attachment;filename=";
string C_HTTP_INLINE = "inline;filename=";
string C_HTTP_CONTENT_TYPE_OCTET = "application/octet-stream";
string C_HTTP_CONTENT_TYPE_EXCEL = "application/vnd.xls";
string C_HTTP_CONTENT_LENGTH = "Content-Length";
string C_QUERY_PARAM_CRITERIA = "Criteria";
string C_ERROR_NO_RESULT = "Data not found.";
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.Clear();
// Add the header that specifies the default filename
// for the Download/SaveAs dialog
response.AddHeader(C_HTTP_HEADER_CONTENT, C_HTTP_ATTACHMENT + fileName +
".XLS");
// Specify that the response is a stream that cannot be read _
// by the client and must be downloaded
response.ContentType = C_HTTP_CONTENT_TYPE_EXCEL;
string ExportContent = null;
ExportContent = ConvertDataViewToString(recordSet.Tables(0).DefaultView, "",
Constants.vbTab, ExportData);
if (ExportContent.Length <= 0) {
ExportContent = C_ERROR_NO_RESULT;
}
System.Text.UnicodeEncoding Encoding = new System.Text.UnicodeEncoding();
response.AddHeader(C_HTTP_CONTENT_LENGTH,
Encoding.GetByteCount(ExportContent).ToString());
response.BinaryWrite(Encoding.GetBytes(ExportContent));
response.Charset = "";
// Stop execution of the current page
response.End();
}
catch (Exception ex) {
}
finally {
}
}
public static void Export(DataTable recordSet, string fileName,
[System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(true)] // ERROR: Optional
parameters aren't supported in C# bool ExportData,
[System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(false)] // ERROR: Optional
parameters aren't supported in C# bool IncludeDummy,
[System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(true)] // ERROR: Optional
parameters aren't supported in C# bool header)
{
try {
string C_HTTP_HEADER_CONTENT = "Content-Disposition";
string C_HTTP_ATTACHMENT = "attachment;filename=";
string C_HTTP_INLINE = "inline;filename=";
string C_HTTP_CONTENT_TYPE_OCTET = "application/octet-stream";
string C_HTTP_CONTENT_TYPE_EXCEL = "application/vnd.xls";
string C_HTTP_CONTENT_LENGTH = "Content-Length";
string C_QUERY_PARAM_CRITERIA = "Criteria";
string C_ERROR_NO_RESULT = "Data not found.";
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.Clear();
// Add the header that specifies the default filename
// for the Download/SaveAs dialog
response.AddHeader(C_HTTP_HEADER_CONTENT, C_HTTP_ATTACHMENT + fileName +
".XLS");
// Specify that the response is a stream that cannot be read _
// by the client and must be downloaded
response.ContentType = C_HTTP_CONTENT_TYPE_EXCEL;
string ExportContent = null;
ExportContent = ConvertDataViewToString(recordSet.DefaultView, "",
Constants.vbTab, ExportData, IncludeDummy, header);
if (ExportContent.Length <= 0) {
ExportContent = C_ERROR_NO_RESULT;
}
System.Text.UnicodeEncoding Encoding = new System.Text.UnicodeEncoding();
response.AddHeader(C_HTTP_CONTENT_LENGTH,
Encoding.GetByteCount(ExportContent).ToString());
response.BinaryWrite(Encoding.GetBytes(ExportContent));
response.Charset = "";
// Stop execution of the current page
response.End();
}
catch (Exception ex) {
}
finally {
}
//HttpContext.Current.ApplicationInstance.CompleteRequest()
}
public static void ExportTechSpecsData(DataTable recordSet, string fileName,
ExportTemplate TemplateType, [System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(true)] // ERROR: Optional
parameters aren't supported in C# bool ExportData)
{
try {
string C_HTTP_HEADER_CONTENT = "Content-Disposition";
string C_HTTP_ATTACHMENT = "attachment;filename=";
string C_HTTP_INLINE = "inline;filename=";
string C_HTTP_CONTENT_TYPE_OCTET = "application/octet-stream";
string C_HTTP_CONTENT_TYPE_EXCEL = "application/vnd.xls";
string C_HTTP_CONTENT_LENGTH = "Content-Length";
string C_QUERY_PARAM_CRITERIA = "Criteria";
string C_ERROR_NO_RESULT = "Data not found.";
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.Clear();
// Add the header that specifies the default filename
// for the Download/SaveAs dialog
response.AddHeader(C_HTTP_HEADER_CONTENT, C_HTTP_ATTACHMENT + fileName +
".XLS");
// Specify that the response is a stream that cannot be read _
// by the client and must be downloaded
response.ContentType = C_HTTP_CONTENT_TYPE_EXCEL;
string ExportContent = null;
//If (Not UomData Is Nothing) AndAlso UomData.Tables(0).Rows.Count > 0 Then
//If Separator = SeparatorTypeEnum.TAB Then
ExportContent = ExportTechSpecs(recordSet.DefaultView, TemplateType, "",
Constants.vbTab);
if (ExportContent.Length <= 0) {
ExportContent = C_ERROR_NO_RESULT;
}
System.Text.UnicodeEncoding Encoding = new System.Text.UnicodeEncoding();
response.AddHeader(C_HTTP_CONTENT_LENGTH,
Encoding.GetByteCount(ExportContent).ToString());
response.BinaryWrite(Encoding.GetBytes(ExportContent));
response.Charset = "";
// Stop execution of the current page
response.End();
}
catch (Exception ex) {
}
// HttpContext.Current.ApplicationInstance.CompleteRequest()
}
private static string ConvertDataViewToString(DataView srcDataView,
[System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(null)] // ERROR: Optional
parameters aren't supported in C# string Delimiter,
[System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(",")] // ERROR: Optional
parameters aren't supported in C# string Separator,
[System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(true)] // ERROR: Optional
parameters aren't supported in C# bool ExportData,
[System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(false)] // ERROR: Optional
parameters aren't supported in C# bool IncludeDummy,
[System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(true)] // ERROR: Optional
parameters aren't supported in C# bool header)
{
StringBuilder ResultBuilder = default(StringBuilder);
ResultBuilder = new StringBuilder();
ResultBuilder.Length = 0;
System.Web.HttpResponse RESPONSE = System.Web.HttpContext.Current.Response;
if (!IncludeDummy) {
for (int i = 0; i <= srcDataView.Table.Columns.Count - 2; i++) {
if ((Delimiter != null) && (Delimiter.Trim.Length > 0)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(Strings.UCase(srcDataView.Table.Columns(i).ColumnName));
if ((Delimiter != null) && (Delimiter.Trim.Length > 0)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(Separator);
}
}
else {
for (int i = 0; i <= srcDataView.Table.Columns.Count - 1; i++) {
if ((Delimiter != null) && (Delimiter.Trim.Length > 0)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(Strings.UCase(srcDataView.Table.Columns(i).ColumnName));
if ((Delimiter != null) && (Delimiter.Trim.Length > 0)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(Separator);
}
}
if (ResultBuilder.Length > Separator.Trim.Length) {
ResultBuilder.Length = ResultBuilder.Length - Separator.Trim.Length;
}
ResultBuilder.Append(Environment.NewLine);
if (!IncludeDummy) {
for (int i = 0; i <= srcDataView.Table.Columns.Count - 2; i++) {
if ((Delimiter != null) && (Delimiter.Trim.Length > 0)) {
ResultBuilder.Append(Delimiter);
}
string column = Strings.UCase(srcDataView.Table.Columns(i).ToString);
if (header == false) {
}
else {
}
//If (column = "NOUN") Or (column = "HIPL_ID") Or (column = "MODIFIER") Or
(column = "SOURCEDESC") Or (column = "ATTRIBUTE") Then
// ResultBuilder.Append("DO NOT CHANGE")
//Else
// ResultBuilder.Append("CAN BE CHANGED")
//End If
//ResultBuilder.Append(Separator)
}
}
if (header == false) {
}
else {
}
// ResultBuilder.Append(Environment.NewLine)
Style style1 = new Style();
style1.Font.Bold = true;
//Dim aRow As DataRowView
if (!(ExportData == false)) {
for (int k = 0; k <= srcDataView.Table.Rows.Count - 1; k++) {
//For Each aCol In srcDataView.Table.Columns
if (!IncludeDummy) {
for (int i = 0; i <= srcDataView.Table.Columns.Count - 2; i++) {
if ((Delimiter != null) && (Delimiter.Trim.Length > 10)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(RemoveHardSpaces(srcDataView.Table.Rows(k).Item(i).ToString()));
if ((Delimiter != null) && (Delimiter.Trim.Length > 10)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(Separator);
}
}
else {
for (int i = 0; i <= srcDataView.Table.Columns.Count - 1; i++) {
if ((Delimiter != null) && (Delimiter.Trim.Length > 10)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(RemoveHardSpaces(srcDataView.Table.Rows(k).Item(i).ToString()));
if ((Delimiter != null) && (Delimiter.Trim.Length > 10)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(Separator);
}
}
ResultBuilder.Length = ResultBuilder.Length - 1;
ResultBuilder.Append(Constants.vbNewLine);
}
}
if ((ResultBuilder != null)) {
return ResultBuilder.ToString();
}
else {
return string.Empty;
}
}
public enum ExportTemplate
{
TechSpecs,
StdAttributes
}
private static string ExportTechSpecs(DataView srcDataView, ExportTemplate
TemplateType, [System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(null)] // ERROR: Optional
parameters aren't supported in C# string Delimiter,
[System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(",")] // ERROR: Optional
parameters aren't supported in C# string Separator,
[System.Runtime.InteropServices.OptionalAttribute,
System.Runtime.InteropServices.DefaultParameterValueAttribute(true)] // ERROR: Optional
parameters aren't supported in C# bool ExportData)
{
StringBuilder ResultBuilder = default(StringBuilder);
ResultBuilder = new StringBuilder();
ResultBuilder.Length = 0;
System.Web.HttpResponse RESPONSE = System.Web.HttpContext.Current.Response;
//Dim aCol As DataColumn
//For Each aCol In srcDataView.Table.Columns
for (int i = 0; i <= srcDataView.Table.Columns.Count - 2; i++) {
if ((Delimiter != null) && (Delimiter.Trim.Length > 0)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(srcDataView.Table.Columns(i).ColumnName);
if ((Delimiter != null) && (Delimiter.Trim.Length > 0)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(Separator);
}
if (ResultBuilder.Length > Separator.Trim.Length) {
ResultBuilder.Length = ResultBuilder.Length - Separator.Trim.Length;
}
ResultBuilder.Append(Environment.NewLine);
Style style1 = new Style();
style1.Font.Bold = true;
//Dim aRow As DataRowView
for (int k = 0; k <= srcDataView.Table.Rows.Count - 1; k++) {
//For Each aCol In srcDataView.Table.Columns
if (TemplateType == ExportTemplate.TechSpecs) {
for (int i = 0; i <= srcDataView.Table.Columns.Count - 2; i++) {
if ((Delimiter != null) && (Delimiter.Trim.Length > 10)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(RemoveHardSpaces(srcDataView.Table.Rows(k).Item(i).ToString()));
if ((Delimiter != null) && (Delimiter.Trim.Length > 10)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(Separator);
}
}
else if (TemplateType == ExportTemplate.StdAttributes) {
for (int i = 0; i <= srcDataView.Table.Columns.Count - 2; i++) {
if ((Delimiter != null) && (Delimiter.Trim.Length > 10)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(RemoveHardSpaces(srcDataView.Table.Rows(k).Item(i).ToString()));
if ((Delimiter != null) && (Delimiter.Trim.Length > 10)) {
ResultBuilder.Append(Delimiter);
}
ResultBuilder.Append(Separator);
}
}
ResultBuilder.Length = ResultBuilder.Length - 1;
ResultBuilder.Append(Constants.vbNewLine);
}
if ((ResultBuilder != null)) {
return ResultBuilder.ToString();
}
else {
return string.Empty;
}
}
private static string RemoveHardSpaces(string str)
{
string functionReturnValue = null;
try {
//removes blank spaces in between the string
string[] words = null;
//Dim x As Long
StringBuilder temp = new StringBuilder();
// = ""
words = Strings.Split(str, Strings.Chr(13));
for (int i = 0; i <= words.Length - 1; i++) {
temp.Append(words(i).Trim() + " ");
}
//.Replace(Chr(13), " ")
functionReturnValue = temp.ToString.Trim();
}
catch (Exception ex) {
return str;
}
//THROW
return functionReturnValue;
}
public Export2Excel()
{
}
}
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply