|
Please post your code and the compiler/runtime error messages.
|
|
|
|
|
When i run tje application, it executes successfully but after entering the login info..there generates an error "Instance Failure"
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.Data.SqlClient;
namespace Ads_Sertrack_System
{
public partial class frmLogin : Form
{
public frmLogin()
{
InitializeComponent();
this.MaximizeBox = false;
this.MinimizeBox = false;
this.StartPosition = FormStartPosition.CenterScreen;
this.WindowState = FormWindowState.Normal;
this.AutoSizeMode = AutoSizeMode.GrowOnly;
this.AutoSize = true;
}
SqlConnection conAdSertrack = new SqlConnection();
string strQry;
SqlCommand cmdLogin;
SqlDataReader dtrLogin;
public static int intLogInId;
public static string strUserName;
public static string strUserRole;
private void frmLogin_Load(object sender, EventArgs e)
{
try
{
conAdSertrack.ConnectionString = ConfigurationManager.ConnectionStrings["con"].ToString();
}
catch (Exception expMsg)
{
MessageBox.Show(expMsg.Message.ToString(), "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnLogin_Click(object sender, EventArgs e)
{
try
{
errProvider.Clear();
if (txtUserName.Text == "")
{
errProvider.SetError(txtUserName, "Please Enter User Name");
MessageBox.Show("Please Enter User Name", "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtUserName.Focus();
}
else if (txtPassword.Text == "")
{
errProvider.SetError(txtPassword, "Please Enter Password");
MessageBox.Show("Please Enter Password", "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtPassword.Focus();
}
else
{
strQry = "select userid,username,userrole" +
" from tblusermaster where username = @paramUNm and pwd = @paramPwd";
cmdLogin = new SqlCommand(strQry, conAdSertrack);
cmdLogin.Parameters.Add("@paramUNm", SqlDbType.VarChar, 30).Value = txtUserName.Text;
cmdLogin.Parameters.Add("@paramPwd", SqlDbType.VarChar, 30).Value = txtPassword.Text;
if (conAdSertrack.State == ConnectionState.Closed)
{
conAdSertrack.Open();
}
dtrLogin = cmdLogin.ExecuteReader();
if (dtrLogin.HasRows)
{
dtrLogin.Read();
intLogInId = Convert.ToInt32(dtrLogin[0].ToString().Trim());
strUserName = Convert.ToString(dtrLogin[1].ToString().Trim());
strUserRole = Convert.ToString(dtrLogin[2].ToString().Trim());
frmMDI formMdi = new frmMDI();
formMdi.Show();
this.txtPassword.Text = "";
this.txtUserName.Text = "";
this.Hide();
}
else
{
MessageBox.Show("InValid User Name & Password", "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtUserName.Text = "";
txtPassword.Text = "";
txtUserName.Focus();
}
dtrLogin.Close();
conAdSertrack.Close();
}
}
catch (Exception expMsg)
{
MessageBox.Show(expMsg.Message.ToString(), "Innor Solutions Pvt. Ltd", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
try
{
Application.Exit();
}
catch (Exception expMsg)
{
MessageBox.Show(expMsg.Message.ToString(), "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void frmLogin_FormClosing(object sender, FormClosingEventArgs e)
{
try
{
Application.Exit();
}
catch (Exception expMsg)
{
MessageBox.Show(expMsg.Message.ToString(), "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void txtUserName_TextChanged(object sender, EventArgs e)
{
try
{
errProvider.Clear();
}
catch (Exception expMsg)
{
MessageBox.Show(expMsg.Message.ToString(), "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void txtPassword_TextChanged(object sender, EventArgs e)
{
try
{
errProvider.Clear();
}
catch (Exception expMsg)
{
MessageBox.Show(expMsg.Message.ToString(), "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
|
|
|
|
|
Can you please post your connectionstring and what database do you use (maybe SQL-Server Express 2005?).
|
|
|
|
|
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="con" connectionString="Server=.\\sqlexpress;Integrated Security=true; Initial Catalog=AdSertrack_WinPrj;User Instance=false;"/>
</connectionStrings>
</configuration>
|
|
|
|
|
Try server=.\SQLExpress. (only one \)
|
|
|
|
|
|
No problem.
And if I may say so, its not the best way to execute sql-queries directly in your UI.
|
|
|
|
|
I am trying to create a Tabbed List Box in a web page. I have done it in a windows application and it worked perfectly, but I can't find one little tiny piece of information and need some help.
I am trying to use SendMessage with the ListBox and all the examples I see say to use this:
SendMessage(List1.hWnd, LB_SETTABSTOPS, ListBoxTabs.Length, ref ListBoxTabs[0]);
However! There is no hWnd property for the ListBox control. In the windows app it's List1.Handle, however, there is no such property for that in the web control either! Can someone explain to me how to find the hWnd property of a web ListBox?
Thanks in advance for any help you can give.
|
|
|
|
|
MarkyMark1961 wrote: Can someone explain to me how to find the hWnd property of a web ListBox?
There isn't one. You need to spend some time reading up on how to create server controls for ASP.NET before proceeding.
only two letters away from being an asset
|
|
|
|
|
Then why are there examples showing that there is?
|
|
|
|
|
You are most likely confused. Show these sources.
only two letters away from being an asset
|
|
|
|
|
try this one it shows exactly what I was saying among others...
http://www.vb-helper.com/howto_listbox_tabs.html
|
|
|
|
|
Yes, you are very confused.
One, this is for a Windows application. As we have told you SendMessage is not available in ASP.NET.
Two, you are using VB
only two letters away from being an asset
|
|
|
|
|
You're absolutely right! You ARE only two letters away from being an asset!
|
|
|
|
|
Or this one....
http://www.devx.com/vb2themax/Tip/18592
If you don't have anything helpful or constructive to contribute, then why contribute at all?
|
|
|
|
|
Again, Windows, not ASP.NET.
Seriously, stop what you are doing and start reading up on ASP.NET.
only two letters away from being an asset
|
|
|
|
|
Because you are told you don't understand a topic and are given the advice to study it, you vote 1? Very mature. If it was not you, then the same goes for whomever did. At least identify yourself and accept the responsibility to explain why.
only two letters away from being an asset
|
|
|
|
|
The ASP.NET ListBox Server control is completely different from its Windows counterpart. It is just a wrapper over HTML Select tag. Much of what you can do with windows listbox cannot be done with ASP.NET list box. Get yourself a good book on ASP.NET, you may be able to find what you are trying to achieve.
|
|
|
|
|
Im trying to limit the scope of active firectory searches
Searching for users and groups, this code works fine;
String[] properties = { "objectGUID", "sAMAccountName", "displayName", "mail", "member" };
String filter = "(| (objectClass=group) (objectClass=user) )";
DirectorySearcher searcher = null;
try
{
DirectoryEntry de = new DirectoryEntry("LDAP://DC=MyCompany,DC=com");
searcher = new DirectorySearcher(filter, properties);
searcher.SearchRoot = de;
// For a directory synchronization search search scope must be subtree
searcher.SearchScope = SearchScope.Subtree;
searcher.Sort = new SortOption("name", SortDirection.Ascending);
searcher.DirectorySynchronization = new DirectorySynchronization();
// Do the search - results should be all groups and users
SearchResultCollection results = searcher.FindAll();
//For brevity display results in small worker
displayResults(results);
// Results are disposed explicitly
results.Dispose();
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
BUT, if i try to start the search from within the tree, I get "COM Exception, access denied"
DirectoryEntry de = new DirectoryEntry("LDAP://OU=Sales,DC=MyCompany,DC=com");
I see examples with "OU=MyOrgUnit" all over - but I cant get it to work.
However, a DirectoryEntry works with the OU= in the root path
Any insight is greatly appreciated
Bill in PA/USA
|
|
|
|
|
Hi,
I am using vb.net and i want to fire labels mousehover and other events when user pressed mouse left buttion.so anybody have any idea pl. answer immediatily.
thanks in advance.
sanjay
|
|
|
|
|
Sanjqfar wrote: answer immediatily.
This is considered rude. If anyone has the answer they will respond in their own time and at their own convenience.
[edit]spelling[/edit]
modified on Monday, October 26, 2009 1:31 PM
|
|
|
|
|
I am facing a issue with the IIS on Windocs XP Pro SP3. I installed the IIS and checked that IIS and web services are up. Then I tried to access the http://localhost page but I am unable to see the page and getting HTTP error 404. I checked that I have file "C:\Inetpub\wwwroot\iisstart.asp" with correct permissions. I have read so may help on web but none is working for me Actully my main problem is to run the CGI application using IIS. When I try to run any of CGI application on my PC I am getting the error "The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:". Same application is running on other PC with same IIS setup. Kindly share your experience regarding the same. Thanks in Advance.
|
|
|
|
|
|
thanks. I got it fixed now. IIS dont allow to see default page in some cases.
|
|
|
|
|
Imports System.Windows.Forms
Imports Microsoft.Win32
Imports SpeechLib
Public Class Form1
Inherits System.Windows.Forms.Form
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Dim Phrase As String
Private Sub AxDirectSR1_ClickIn(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub AxDirectSR1_PhraseFinish(ByVal sender As System.Object, ByVal e As AxACTIVELISTENPROJECTLib._DirectSREvents_ClickInEvent)
Dim sFile As String
Dim noth As Long
Select Case Phrase
Case "Internet"
sFile = "C:\Program Files\Internet Explorer\iexplore.exe"
noth = Shell(sFile, 1)
Case "Notepad"
sFile = "\system32\notepad.exe"
noth = ShellExecute(0, "OPEN", Environ("SystemRoot") & sFile, "", "", 1)
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim totaldata As String
AxDirectSS1.Speak("welcome to the speech recognization")
totaldata = "[Grammar]" & vbCrLf & "langid = 1033" & vbCrLf & "type = cfg" & vbCrLf & "[<Start>]" & vbCrLf & "<Start>= iexplore" & vbCrLf & "<start>=Notepad" & vbCrLf
AxDirectSR1.GrammarFromString(totaldata)
AxDirectSR1.Activate()
End Sub
Private Sub AxDirectSS1_ClickIn(ByVal sender As System.Object, ByVal e As AxACTIVEVOICEPROJECTLib._DirectSSEvents_ClickInEvent)
End Sub
Private Sub AxDirectSR1_ClickIn(ByVal sender As System.Object, ByVal e As AxACTIVELISTENPROJECTLib._DirectSREvents_ClickInEvent)
End Sub
End Class
i hv built this code for speech recognization for opening internet explorer nd notepad through voice....there is no builds errors...but whenevr i speak(voice command)notepad or internet the application can not get open..is there anything missing in this code??any setting should required??..plz i need ur help....
|
|
|
|
|