|
1)sorry .I didnt find SQL forum.
2)dot(.) ===> . instance or local
3)where i can find instances of sql server 2005
|
|
|
|
|
Each instance of SQL Server on a system must have a unique name.
|
|
|
|
|
Hello
We have a asp.net website that has reference to simIO.dll which was developed by my predecessor. I have the source project of simIO.dll in hand. This inturn refers to a 3rd party dll called config.dll (using DllImport). Now the 3rd party has released a newer version of config.dll that I need to update in our website.
I first tried to replace the new version of config.dll in the system32 folder and got the following error.
The specified module could not be found. (Exception from HRESULT: 0x8007007E) can not be loaded.
But it works fine with the older version config.dll
Can somebody advise me how to change the reference to the new dll?
Many thanks
Kit
|
|
|
|
|
In the simIO project you need to replace the reference to the old config.dll with the new config.dll and then recompile the project, otherwise the simIO.dll will try to call the old config.dll which has been replaced.
Learning without thought is labor lost; thought without learning is perilous. (Confucius)
|
|
|
|
|
Many thanks for the swift reply.
The simIO project uses
DllImport("config.dll", EntryPoint="ReadWrite@10", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)
I replaced the config.dll in system32 folder and recompiled simIO and replaced the new simIO.dll in the website. I am unsure whether this is sufficient. How to I change the reference of config.dll in simIO project?
|
|
|
|
|
Nevermind the references in the project if u use DllImport to call the dll.
Try specifing the full path of the dll to see if the dll could be found.
Also try to put in the dll into the bin folder of the project. (If your config.dll resides in the system32 folder,the app that calls the dll should be run in the same folder...)
Learning without thought is labor lost; thought without learning is perilous. (Confucius)
|
|
|
|
|
I tried putting the new version in bin folder. no help.
I'll see whether its possible to include full path of the dll in dllImport
However the last part of ur reply is not clear. What do u mean by my app should reside in system32??
thanks again.
Kit
|
|
|
|
|
I have a class that interops with a booking tool, the class only returns system._ComObjects
I can do late binding cause I know what type is being returned.
public BindingList<NameElement> GetPassengers()
{
BindingList<NameElement> names = new BindingList<NameElement>();
ComClass _comClass = new ComClass();
comClass.RetrieveCurrent();
foreach (NameElement name in comClass.IObj_NameElements)
{
names.Add(name);
}
return names;
}
The problem is that when I try to use this list to bind it to a control by setting it's datasource to this list, the displaymember and valuemember can't be set because I get the error : 'Cannot bind to the new display member.
Parameter name: newDisplayMember'
Calling properties from the NameElement objects is no problem:
Console.WriteLine(names[0].LastName)
I have no clue why the data binding doesn't work ...
Any help is as appreciated.
modified on Wednesday, January 27, 2010 8:40 AM
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Data.Odbc;
using System.Data.Common;
using System.Data;
using System.IO;
namespace sample27
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show("values get inserted");
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
}
}
class v
{
public static void main(string[] args)
{
string name = null;
string pwd = null;
int i=0;
string connstr = "/*connection string*/"
SqlConnection conn = new SqlConnection(connstr);
conn.Open();
StreamReader sr = new StreamReader(@"e:\v.txt");
string query = "insert into samplereg(username,password) values(@username,@password)";
name= sr.ReadLine();
while (name != null)
{
i++;
SqlCommand cmd = new SqlCommand(query, conn);
cmd.Parameters.Add("@username", name); //error
cmd.Parameters.Add("@password", pwd );
cmd.ExecuteNonQuery();
name = sr.ReadLine();
conn.Close();
}
}
}
}
error:Add(string parametername,object value) has been depricated.use Addwithvalue(String parametername,object value)
pls reply me ......
|
|
|
|
|
Well, the first thing I would try is using the recommended method.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
The second thing I would recommend is reading the suggestions, specifically, about wrapping code blocks in PRE tags.
Cheers,
Vikram. (Got my troika of CCCs!)
|
|
|
|
|
Try using the LiquidNitrogen object.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Don't be so ridiculous.
This is NOT what the LiquidNitrogen class was designed for.
|
|
|
|
|
Well, I was originally going to recommend The InternallyAdjustableThrowoutPiston object, but it's not as widely used, not to mention that LiquidNitrogen object has the same properties because they share the same base class (SpanishInquisition , which nobody expected), and it consumes a lot less memory.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: LiquidNitrogen object has the same properties because they share the same base class (SpanishInquisition, which nobody expected), and it consumes a lot less memory.
I would never have expected that. I was going to recommend using the ILeftHandThread Interface with the StarboardMufflerBearing object, but your solution is clearly better.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Hi All,
I want to retrieve SSL Certification status in my C# application.
Can anybody help me?
Thanking You,
Sunil G.
|
|
|
|
|
|
|
Hello anyone..,
How we can differentiate between an encrypted and none encrypted txt???
i need a method for that, to using in my project...,
Please help me.........,,,
An encryption methode is below:
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.Configuration;
namespace SharpPcap.EnCryptDecrypt
{
public class CryptorEngine
{
public static string Encrypt(string toEncrypt, bool useHashing)
{
byte[] keyArray;
byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(toEncrypt);
System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader();
string key = (string)settingsReader.GetValue("SecurityKey", typeof(String));
if (useHashing)
{
MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key));
hashmd5.Clear();
}
else
keyArray = UTF8Encoding.UTF8.GetBytes(key);
TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
tdes.Key = keyArray;
tdes.Mode = CipherMode.ECB;
tdes.Padding = PaddingMode.PKCS7;
ICryptoTransform cTransform = tdes.CreateEncryptor();
byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
tdes.Clear();
return Convert.ToBase64String(resultArray, 0, resultArray.Length);
}
}
}
Regards...
modified on Wednesday, January 27, 2010 6:56 AM
|
|
|
|
|
3bood.ghzawi wrote: How we can differentiate between an encrypted and none encrypted txt???
You can't, not without decrypting. It is possible to perform a preliminary check to see whether the decryption "string" is HEX (which encrypted strings are), but not all HEX strings are encrypted information. The only reliable way is to attempt to decrypt, even then it only checks for the decryption key.
Also this is worrying:
3bood.ghzawi wrote:
string key = (string)settingsReader.GetValue("SecurityKey", typeof(String));
The app config is by-and-large publicly available, and the key *MUST*
be kept secret for the cryptography to be worth anything.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
Hi,
I've a service that push data from MSSQL db based on time frequency. Everything is fine, except while starting the system. At this time alone an error is coming "Operation not allowed when the object is closed."
I traced this error, this is because my service is start the prcoess before the SQL server is stared. I can handle this either delaying my service process to 2 or 5 mins or I can handle this exception in my catch block.
But I want to know any other way to handle this, like can I force my service once the SQL server is started or Is it possible to check a windows service (SQL Server) was started or not.
If any idea pls share with us.
Thanks & Regards,
Rishi
WinCrs
|
|
|
|
|
Hi,
there is a possibility to set on which services your service depends. Only if these services are running your service will start too. Since you are using C# guess you wrote an installer for your service, did you? During the install you can set the ServiceDependsOn-property.
Have a look here:
http://msdn.microsoft.com/en-us/library/system.serviceprocess.serviceinstaller.servicesdependedon.aspx[^]
All you have to do is to set this propery during installation to the name of the sql server service name (check by open the properties of the service).
Regards
Sebastian
|
|
|
|
|
You should change the service config/start state by setting the "SeviceDependedOn" value with an array of services that needs to be started before your service can start.
ServiceInstaller example:
[RunInstallerAttribute(true)]
public class ControllerInstaller : Installer
{
public ControllerInstaller()
{
processInstaller=new ServiceProcessInstaller();
serviceInstaller=new ServiceInstaller();
processInstaller.Account=ServiceAccount.LocalSystem;
serviceInstaller.StartType=ServiceStartMode.Automatic;
serviceInstaller.DisplayName = "ServiceDisplyName";
serviceInstaller.ServiceName = "ServiceName";
serviceInstaller.ServicesDependedOn = new string[] { "MSSQL$SQLEXPRESS" };
Installers.Add(serviceInstaller);
Installers.Add(processInstaller);
}
private ServiceInstaller serviceInstaller;
private ServiceProcessInstaller processInstaller;
}
Now your service depends on a service called MSSQL$SQLEXPRESS (service name not display name) and
the system tries to start this service before yours. If it can't start this service your service can't start too.
Here some code to do this execution time:
(You need the permissions to access these registry keys!)
string[] szArrayDependsOn = (string[])Registry.GetValue("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\[YourServiceName]", "DependOnService", null);
if ((szArrayDependsOn == null) || (szArrayDependsOn.Length != 1) ||
(szArrayDependsOn[0] == null) || (szArrayDependsOn[0].ToUpper() != "MSSQL$SQLEXPRESS")
{
Registry.SetValue("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\[YourServiceName]", "DependOnService", new string[] { "MSSQL$SQLEXPRESS" }, RegistryValueKind.MultiString);
}
Greetings
Covean
|
|
|
|
|
And also handle it in a catch.
|
|
|
|
|