-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: DotNetHunk
Message 1 in Discussion

hiiii all
pl dont' think that its a lengthy piece of code,its jus a tricky part in the 
code  im not getting away with.pl review the lines marked in red yaar,im 
running out of my time on my maiden project.
a dataset is populated with the required data and is assigned to dataview which 
happens to be the source for datagrid.im having a problem with the 
dataview::the dataview rowfilter condition is not yielding any results.when i 
try the same query in sql server,i get results.where am i wrong??please 
consider me plea..

thanx in advance
kiran k

employer.aspx.vb:::
Imports System.Data

Imports System.Data.sqlclient

Imports System.Web.mail

Imports System.Configuration

Imports System.Web.UI.WebControls

Namespace Employer1

Public Class employer : Inherits System.Web.UI.Page

Dim chkSelected As CheckBox

Dim ds As New DataSet

Dim dv As New DataView

Dim objDR1, objDR2 As SqlDataReader

Protected WithEvents DataGrid1 As DataGrid

Protected WithEvents Button1 As Button

Protected WithEvents lblMsg As Label

Protected WithEvents btnSubmit As Button

Protected WithEvents txtBox As TextBox

Protected WithEvents DropDownList1 As DropDownList

Protected WithEvents DropDownList2 As DropDownList

Protected WithEvents lblDV As System.Web.UI.WebControls.Label

Protected WithEvents RequiredFieldValidator1 As 
System.Web.UI.WebControls.RequiredFieldValidator

Protected WithEvents RequiredFieldValidator2 As 
System.Web.UI.WebControls.RequiredFieldValidator

'NOTE: The following placeholder declaration is required by the Web Form 
Designer.

'Do not delete or move it.

Private designerPlaceholderDeclaration As System.Object



Private Sub Page_Load(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles 

MyBase.Load

'Put user code to initialize the page here


If Not IsPostBack Then

BindTheData()

End If

End Sub

Sub BindTheData()

Dim objConn As SqlConnection

Dim objDrop1, objDrop2 As SqlCommand

objConn = New SqlConnection("data source=localhost;user id=sa;password=;initial 

catalog=onlinejobapp")

Try

objConn.Open()

Dim strDrop1, strDrop2 As String

Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT * from employerview", 
objConn)

da.Fill(ds, "employerview")

dv = New DataView(ds.Tables("employerview"))

DataGrid1.DataSource = dv

DataGrid1.DataBind()

strDrop1 = "select * from skill where skill<>''"

objDrop1 = New SqlCommand(strDrop1, objConn)

objDR1 = objDrop1.ExecuteReader

DropDownList1.DataSource = objDR1

DropDownList1.DataBind()

DropDownList1.Items.Insert(0, New ListItem("-- Choose a Skill --"))

objDR1.Close()

strDrop2 = "select distinct emp_experience_years from emp_summary "

objDrop2 = New SqlCommand(strDrop2, objConn)

objDR2 = objDrop2.ExecuteReader

DropDownList2.DataSource = objDR2

DropDownList2.DataBind()

DropDownList2.Items.Insert(0, New ListItem("-- Choose Experience --"))

objDR2.Close()

Catch

Finally

If objConn.State = ConnectionState.Open Then

objConn.Close()

objConn.Dispose()

End If

End Try

End Sub

Sub SearchIT(ByVal sender As System.Object, ByVal e As System.EventArgs)

Dim skill As String = DropDownList1.SelectedItem.Value

Dim exp As Integer = CInt(DropDownList2.SelectedItem.Value)

Dim result As String

result = "emp_skill1 LIKE '" + skill + "'"

result += "and emp_experience_years >= " & exp

'dv = New DataView(ds.Tables("employerview"))

dv.RowFilter = result

lblDV.Text = "one::" & DropDownList1.SelectedItem.Value & "two:::" & 

DropDownList2.SelectedItem.Value

'lblDV.Text += dv.Count

If dv.Count > 0 Then

DataGrid1.DataBind()

lblMsg.Text = dv.Count & " row(s) found...."

DataGrid1.Visible = True

Else

lblMsg.Text = "No records found.."

DataGrid1.Visible = False

End If

End Sub



Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles 

btnSubmit.Click

Dim dgItem As DataGridItem

Dim name As String

Dim emailId As String

For Each dgItem In DataGrid1.Items

chkSelected = dgItem.FindControl("chkSelection")

If chkSelected.Checked Then

Try

name = CType(dgItem.FindControl("lblFirstName"), Label).Text

' strCustomerID = CType(dgItem.FindControl("lblEmpID"), Label).Text

emailId = CType(dgItem.FindControl("lblEmailId"), Label).Text

Dim mail As New MailMessage

mail.To = emailId

mail.From = "[EMAIL PROTECTED]"

mail.Subject = "first trial test!!!"

mail.Body = "ull succeed ra,don' worry!!" & txtBox.Text

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate";,
 "1") 'basic 

authentication

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername";, 

"rayofvictory2002") 'set your username here

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword";, 
"swatik") 'set 

your password here

SmtpMail.SmtpServer = "smtp.mail.yahoo.com" 'your real server goes here

SmtpMail.Send(mail)

lblMsg.Text = "Mail has been sent to the following guys::
"

lblMsg.Text += "First Name: " & name & " | "

Catch

lblMsg.Text = "sorry,mail could not be sent"

End Try

End If

Next

End Sub

Private Sub InitializeComponent()

End Sub

End Class

End Namespace



employer.aspx::

 

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="employer.aspx.vb" 

Inherits="dropdownlistEx.Employer1.employer"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <title>employer</title>
  <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
  <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
  <meta content="JavaScript" name="vs_defaultClientScript">
  <meta content="http://schemas.microsoft.com/intellisense/ie5"; 
name="vs_targetSchema">
 </HEAD>
 <body MS_POSITIONING="GridLayout">
  <form id="Form1" action="employer.aspx" method="post" runat="server">
   <asp:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 8px; POSITION: 
absolute; TOP: 128px" 

runat="server"
    Width="686px" DataKeyField="emp_id" BorderColor="#CCCCCC" 
BorderStyle="None" 

BorderWidth="1px"
    BackColor="White" CellPadding="3" AutoGenerateColumns="False" PageSize="5">
    <SelectedItemStyle Font-Bold="True" ForeColor="White" 

BackColor="#669999"></SelectedItemStyle>
    <ItemStyle ForeColor="#000066"></ItemStyle>
    <HeaderStyle Font-Bold="True" ForeColor="White" 
BackColor="#006699"></HeaderStyle>
    <FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
    <Columns>
     <asp:TemplateColumn HeaderText="lblFirstName">
      <ItemTemplate>
       <asp:Label id=lblFirstName runat="server" Text='<%# 

DataBinder.Eval(Container.DataItem,"emp_first_name") %>'>
       </asp:Label>
      </ItemTemplate>
     </asp:TemplateColumn>
     <asp:TemplateColumn Visible="False" HeaderText="Email Id">
      <ItemTemplate>
       <asp:Label id="lblEmailId" Runat="server" Text='<%# 

DataBinder.Eval(Container.DataItem,"emp_email_id") %>'>
       </asp:Label>
      </ItemTemplate>
     </asp:TemplateColumn>
     <asp:BoundColumn DataField="emp_first_name" 
SortExpression="emp_first_name" 

HeaderText="first name"></asp:BoundColumn>
     <asp:BoundColumn DataField="emp_skill1" SortExpression="emp_skill1" 

HeaderText="skill1"></asp:BoundColumn>
     <asp:BoundColumn DataField="emp_skill2" SortExpression="emp_skill2" 

HeaderText="skill2"></asp:BoundColumn>
     <asp:BoundColumn DataField="emp_skill3" SortExpression="emp_skill3" 

HeaderText="skill3"></asp:BoundColumn>
     <asp:BoundColumn DataField="emp_skill4" SortExpression="emp_skill4" 

HeaderText="skill4"></asp:BoundColumn>
     <asp:BoundColumn DataField="emp_skill5" SortExpression="emp_skill5" 

HeaderText="skill5"></asp:BoundColumn>
     <asp:BoundColumn DataField="emp_min_sal" SortExpression="emp_min_sal" 
HeaderText="Desired 

Salary"></asp:BoundColumn>
     <asp:BoundColumn DataField="emp_desired_location" 
SortExpression="emp_desired_location" 

HeaderText="Desired location"></asp:BoundColumn>
     <asp:BoundColumn DataField="emp_experience_years" 
SortExpression="emp_experience_years" 

HeaderText="Experience(yrs)"></asp:BoundColumn>
     <asp:HyperLinkColumn Target="_blank" DataNavigateUrlField="emp_id" 

DataNavigateUrlFormatString="Catalog.aspx?strParent={0}"
      DataTextField="emp_id" HeaderText="Candidate 
Profile"></asp:HyperLinkColumn>
     <asp:TemplateColumn HeaderText="Select Candidates">
      <ItemStyle HorizontalAlign="Center"></ItemStyle>
      <ItemTemplate>
       <asp:CheckBox id="chkSelection" Runat="server"></asp:CheckBox>
      </ItemTemplate>
     </asp:TemplateColumn>
     <asp:BoundColumn DataField="emp_email_id" SortExpression="emp_email_id" 
HeaderText="Email 

ID"></asp:BoundColumn>
    </Columns>
    <PagerStyle HorizontalAlign="Left" ForeColor="#000066" 
BackColor="White"></PagerStyle>
   </asp:datagrid><asp:button id="Button1" style="Z-INDEX: 102; LEFT: 480px; 
POSITION: absolute; 

TOP: 48px" onclick="SearchIT"
    runat="server" Text="search"></asp:button><asp:label id="lblMsg" 
style="Z-INDEX: 103; LEFT: 

224px; POSITION: absolute; TOP: 96px" runat="server"
    Width="273px"></asp:label><asp:textbox id="txtBox" style="Z-INDEX: 104; 
LEFT: 416px; 

POSITION: absolute; TOP: 328px" runat="server"
    Width="208px">Input time and date of the interview</asp:textbox><asp:button 
id="btnSubmit" 

style="Z-INDEX: 105; LEFT: 96px; POSITION: absolute; TOP: 328px"
    runat="server" Width="257px" Text="Invite the selected candidates for 

Interview"></asp:button><asp:dropdownlist id="DropDownList1" style="Z-INDEX: 
106; LEFT: 176px; 

POSITION: absolute; TOP: 48px"
    runat="server" Width="137px" DataValueField="Skill" 

DataTextField="Skill"></asp:dropdownlist><asp:dropdownlist id="DropDownList2" 
style="Z-INDEX: 

107; LEFT: 352px; POSITION: absolute; TOP: 48px"
    runat="server" Width="120px" DataValueField="emp_experience_years" 

DataTextField="emp_experience_years"></asp:dropdownlist><asp:label id="lblDV" 
style="Z-INDEX: 

108; LEFT: 648px; POSITION: absolute; TOP: 40px" runat="server"></asp:label>
   <asp:RequiredFieldValidator id="RequiredFieldValidator1" style="Z-INDEX: 
109; LEFT: 176px; 

POSITION: absolute; TOP: 16px"
    runat="server" ErrorMessage="RequiredFieldValidator" 
ControlToValidate="DropDownList1" 

Display="Dynamic"
    InitialValue="-- Choose a Skill --"></asp:RequiredFieldValidator>
   <asp:RequiredFieldValidator id="RequiredFieldValidator2" style="Z-INDEX: 
110; LEFT: 352px; 

POSITION: absolute; TOP: 16px"
    runat="server" ErrorMessage="RequiredFieldValidator" 
ControlToValidate="DropDownList2" 

Display="Dynamic"
    InitialValue="-- Choose Experience --"></asp:RequiredFieldValidator></form>
 </body>
</HTML>

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to