Ans:-Here i have taken 1 RadComboBox(telerik Control),while i select this RadComboBox automatically fillup all the text boxes and automatically show Gridview.
Below pics is the before selecting RadComboBox..
Below pics is the after selecting RadComboBox..
AsSelectDDLGrdVwWillShow.aspx:-
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="AsSelectDDLGrdVwWillShow.aspx.vb" Inherits="AsSelectDDLGrdVwWillShow" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>AsSelectDDLGrdVwWillShow Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<center>
<table>
<tr>
<td>
<asp:Label ID="Label1" Text="Policy : " runat="server" Font-Bold="True" ></asp:Label>
</td>
<td>
<telerik:radcombobox ID="ddlCode" runat="server" AllowCustomText="true" AutoPostBack="true"
BorderColor="#666666" BorderStyle="Solid" BorderWidth="1px" DropDownCssClass="RadComboBox_Sunset"
EmptyMessage="Select Insurance Company"
EnableEmbeddedSkins="False" EnableLoadOnDemand="true"
EnableViewState="false" EnableVirtualScrolling="True"
Font-Names="Verdana" Font-Size="8.5pt"
MarkFirstMatch="true" ShowMoreResultsBox="True" Skin="Sunset"
Width="300px" TabIndex="12">
</telerik:radcombobox>
</td>
</tr>
<tr><td><br /></td><td><br /></td></tr>
<tr><td><br /></td><td><br /></td></tr>
<tr>
<td>
<asp:Label ID="Label2" Text="Policy Code : " runat="server" Font-Bold="True" ></asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtPolicyCode" Width="144" ReadOnly="True" Rows="10"
TabIndex="3"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" Text="Policy Name : " runat="server" Font-Bold="True" ></asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtPolicyName" Width="144" ReadOnly="True" Rows="10"
TabIndex="3"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" Text="Provider Code : " runat="server" Font-Bold="True" ></asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtProviderCode" Width="144" ReadOnly="True" Rows="10"
TabIndex="3"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" Text="Provider Name : " runat="server" Font-Bold="True" ></asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtProviderName" Width="144" ReadOnly="True" Rows="10"
TabIndex="3"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label6" Text="User Id : " runat="server" Font-Bold="True" ></asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtUserid" Width="144" ReadOnly="True" Rows="10"
TabIndex="3"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan='2'>
<asp:Label ID="lblResult" runat="server" Font-Bold="True" Width="542px" ></asp:Label>
<asp:TextBox runat="server" ID="txtRowCount" Height="1" Width="1" ></asp:TextBox>
</td>
</tr>
</table>
<br/>
<asp:DataGrid ID="dgrPolicy" runat="server" AutoGenerateColumns="False" CellPadding="4"
Font-Bold="False" Font-Names="Verdana" Font-Size="XX-Small" ForeColor="#333333"
GridLines="None" Height="23px" Width="567px" >
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditItemStyle BackColor="#2461BF" />
<SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<AlternatingItemStyle BackColor="White" />
<ItemStyle BackColor="#EFF3FB" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundColumn DataField="policyid" HeaderText="Code">
<ItemStyle HorizontalAlign="Left" Width="20%" />
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundColumn>
<asp:BoundColumn DataField="policyname" HeaderText="PolicyName">
<ItemStyle HorizontalAlign="Left" Width="65%" />
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundColumn>
<asp:BoundColumn DataField="providername" HeaderText="Hospital">
<ItemStyle HorizontalAlign="Left" Width="65%" />
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Delete">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandName="Delete"
Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</center>
</div>
</form>
</body>
</html>
Below pics is the before selecting RadComboBox..
Below pics is the after selecting RadComboBox..
AsSelectDDLGrdVwWillShow.aspx:-
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="AsSelectDDLGrdVwWillShow.aspx.vb" Inherits="AsSelectDDLGrdVwWillShow" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>AsSelectDDLGrdVwWillShow Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<center>
<table>
<tr>
<td>
<asp:Label ID="Label1" Text="Policy : " runat="server" Font-Bold="True" ></asp:Label>
</td>
<td>
<telerik:radcombobox ID="ddlCode" runat="server" AllowCustomText="true" AutoPostBack="true"
BorderColor="#666666" BorderStyle="Solid" BorderWidth="1px" DropDownCssClass="RadComboBox_Sunset"
EmptyMessage="Select Insurance Company"
EnableEmbeddedSkins="False" EnableLoadOnDemand="true"
EnableViewState="false" EnableVirtualScrolling="True"
Font-Names="Verdana" Font-Size="8.5pt"
MarkFirstMatch="true" ShowMoreResultsBox="True" Skin="Sunset"
Width="300px" TabIndex="12">
</telerik:radcombobox>
</td>
</tr>
<tr><td><br /></td><td><br /></td></tr>
<tr><td><br /></td><td><br /></td></tr>
<tr>
<td>
<asp:Label ID="Label2" Text="Policy Code : " runat="server" Font-Bold="True" ></asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtPolicyCode" Width="144" ReadOnly="True" Rows="10"
TabIndex="3"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" Text="Policy Name : " runat="server" Font-Bold="True" ></asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtPolicyName" Width="144" ReadOnly="True" Rows="10"
TabIndex="3"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" Text="Provider Code : " runat="server" Font-Bold="True" ></asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtProviderCode" Width="144" ReadOnly="True" Rows="10"
TabIndex="3"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" Text="Provider Name : " runat="server" Font-Bold="True" ></asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtProviderName" Width="144" ReadOnly="True" Rows="10"
TabIndex="3"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label6" Text="User Id : " runat="server" Font-Bold="True" ></asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtUserid" Width="144" ReadOnly="True" Rows="10"
TabIndex="3"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan='2'>
<asp:Label ID="lblResult" runat="server" Font-Bold="True" Width="542px" ></asp:Label>
<asp:TextBox runat="server" ID="txtRowCount" Height="1" Width="1" ></asp:TextBox>
</td>
</tr>
</table>
<br/>
<asp:DataGrid ID="dgrPolicy" runat="server" AutoGenerateColumns="False" CellPadding="4"
Font-Bold="False" Font-Names="Verdana" Font-Size="XX-Small" ForeColor="#333333"
GridLines="None" Height="23px" Width="567px" >
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditItemStyle BackColor="#2461BF" />
<SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<AlternatingItemStyle BackColor="White" />
<ItemStyle BackColor="#EFF3FB" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundColumn DataField="policyid" HeaderText="Code">
<ItemStyle HorizontalAlign="Left" Width="20%" />
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundColumn>
<asp:BoundColumn DataField="policyname" HeaderText="PolicyName">
<ItemStyle HorizontalAlign="Left" Width="65%" />
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundColumn>
<asp:BoundColumn DataField="providername" HeaderText="Hospital">
<ItemStyle HorizontalAlign="Left" Width="65%" />
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Delete">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandName="Delete"
Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</center>
</div>
</form>
</body>
</html>
AsSelectDDLGrdVwWillShow.aspx.vb:-
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.UI.WebControls
Imports Telerik.Web.UI
Partial Class AsSelectDDLGrdVwWillShow
Inherits System.Web.UI.Page
Dim sqlcon As SqlConnection
Dim sqlcmd As SqlCommand
Dim sqlad As SqlDataAdapter
Dim sqldr As SqlDataReader
Dim dt As New DataTable
Dim ds As New DataSet
Dim obj As New Class1
Dim spStr() As String
Dim dsComm As New DataSet
Dim sFlag As Integer = 0
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
sqlcon = New SqlConnection(obj.Connect) : sqlcon.Open()
If Not IsPostBack Then
'obj.AddComboTi(ddlCode, "select cast(policyid as varchar)+'-'+policyname as Policy from tblpolicy", sqlcon)
End If
End Sub
Protected Sub ddlCode_ItemsRequested(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles ddlCode.ItemsRequested
Try
If sqlcon.State = ConnectionState.Closed Then sqlcon.Open()
'sqlad = New SqlDataAdapter("select cast(policyid as varchar)+'-'+policyname as Policy from tblpolicy where (policyname Like '" + e.Text + "%' or policyid Like '" + e.Text + "%')", sqlcon)
sqlad = New SqlDataAdapter("select ltrim(rtrim(policyid))+'-'+ltrim(rtrim(policyname)) as Policy from tblpolicy where (policyname Like '" + e.Text + "%' or policyid Like '" + e.Text + "%')", sqlcon)
sqlad.Fill(dt)
Dim itemsPerRequest As Integer = 20
Dim itemOffset As Integer = e.NumberOfItems
Dim endOffset As Integer = itemOffset + itemsPerRequest
If endOffset > dt.Rows.Count Then
endOffset = dt.Rows.Count
End If
Dim i As Integer = itemOffset
While i < endOffset
'spStr = Split(dt.Rows(i)("Policy").ToString(), "-")
ddlCode.Items.Add(New RadComboBoxItem(dt.Rows(i)("Policy").ToString()))
i = i + 1
End While
If dt.Rows.Count > 0 Then
e.Message = [String].Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), dt.Rows.Count.ToString())
Else
e.Message = "No matches"
End If
Catch ex As Exception
lblResult.Text = obj.CustomEror(Err.Number)
Finally
sqlcon.Close()
End Try
End Sub
Protected Sub ddlCode_SelectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles ddlCode.SelectedIndexChanged
Try
ddlCode.Attributes.Add("style", "display:''")
If Len(ddlCode.Text) > 0 Then
Dim r As Integer = obj.FetchValue("select COUNT(*) from tblpolicy where ltrim(rtrim(policyid))+'-'+ltrim(rtrim(policyname))='" + ddlCode.Text + "'", sqlcon)
If r = 0 Then
obj.MessageBox(Me, "Code not Found.") : ddlCode.Text = "" : Call Gridfill()
ddlCode.Focus() : obj.PageClear(Me) : sFlag = 1 : Exit Sub
Else
spStr = ddlCode.Text.Split("-")
sqlcmd = New SqlCommand("sp_AutoGenerateGrdVw", sqlcon)
sqlcmd.CommandType = CommandType.StoredProcedure
sqlcmd.Parameters.Add(New SqlParameter("@policyid", spStr(0)))
sqlad = New SqlDataAdapter(sqlcmd)
sqlad.Fill(dsComm, "policytbl")
With dsComm.Tables(0).Rows(0)
txtPolicyCode.Text = .Item("policyid")
txtPolicyName.Text = .Item("policyname")
txtProviderCode.Text = .Item("providerid")
txtProviderName.Text = .Item("providername")
txtUserid.Text = .Item("uid")
End With
dgrPolicy.DataSource = dsComm.Tables(0)
dgrPolicy.DataBind()
ViewState("policytbl") = dsComm
txtRowCount.Text = dsComm.Tables("policytbl").Rows.Count
lblResult.Text = "" : sFlag = 0
End If
End If
Catch ex As Exception
lblResult.Text = obj.CustomEror(Err.Number)
End Try
End Sub
Private Sub Gridfill()
Try
Dim sqlad As SqlDataAdapter
sqlcmd = New SqlCommand("select policyid,policyname from policytbl where 1=2", sqlcon)
sqlad = New SqlDataAdapter(sqlcmd)
sqlad.Fill(dsComm, "policytbl")
dgrPolicy.DataSource = dsComm.Tables(0)
dgrPolicy.DataBind()
txtRowCount.Text = dsComm.Tables("policytbl").Rows.Count
ViewState("policytbl") = dsComm
sqlcmd.Dispose()
Catch ex As Exception
lblResult.Text = obj.CustomEror(Err.Number)
End Try
End Sub
Protected Sub dgrPolicy_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgrPolicy.DeleteCommand
Try
obj.MessageBox(Me, "record deleted sucessfully..")
dsComm = ViewState("policytbl")
dsComm.Tables(0).Rows.RemoveAt(e.Item.ItemIndex)
dgrPolicy.DataSource = dsComm
dgrPolicy.DataBind()
txtRowCount.Text = dsComm.Tables("policytbl").Rows.Count
ViewState("policytbl") = dsComm
Catch ex As Exception
lblResult.Text = obj.CustomEror(Err.Number)
End Try
End Sub
End Class
Class1.vb:-
Imports Microsoft.VisualBasic
Imports System.Web.UI.WebControls
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Data.SqlClient
Imports System.Data.Odbc
Imports Telerik.Web.UI
Public Class Class1
Dim sqlcmd As SqlCommand
Dim sqldr As SqlDataReader
Public dsImport As New DataSet
Public Function Connect() As String
Connect = "Data source=192.168.0.200;Database=SubsDB;Uid=sa;Pwd=amtpl@123;Pooling=true;Min Pool Size=2;Max Pool Size=1000"
End Function
Public Sub AddComboTi(ByVal CntName As RadComboBox, ByVal SqlStr As String, ByVal sCon As SqlConnection)
'Which will fill the DropdownList Based on Query
Try
CntName.Items.Clear()
'Dim Str As String = String.Empty
' CntName.Items.Add(New RadComboBoxItem(""))
sqlcmd = New SqlCommand(SqlStr, sCon)
sqldr = sqlcmd.ExecuteReader()
While sqldr.Read
CntName.Items.Add(New RadComboBoxItem(sqldr(0)))
End While
sqldr.Close() : sqlcmd.Dispose()
Catch ex As Exception
'MsgBox(ex.Message)
End Try
End Sub
Public Sub AddCombo(ByVal CntName As DropDownList, ByVal SqlStr As String, ByVal sCon As SqlConnection)
'Which will fill the DropdownList Based on Query
Try
CntName.Items.Clear()
CntName.Items.Add("")
sqlcmd = New SqlCommand(SqlStr, sCon)
sqldr = sqlcmd.ExecuteReader()
While sqldr.Read
CntName.Items.Add(sqldr(0))
End While
sqldr.Close() : sqlcmd.Dispose()
Catch ex As Exception
'MsgBox(ex.Message)
End Try
End Sub
Public Function getDataSet(ByVal Sqlstr As String, ByVal Sqcon As SqlConnection) As DataSet
Dim getDS As New DataSet
Try
Dim sqlad As New SqlDataAdapter(Sqlstr, Sqcon)
sqlad.Fill(getDS)
getDataSet = getDS
Catch ex As Exception
getDataSet = getDS
End Try
End Function
Public Function FetchValue(ByVal qStr As String, ByVal sCon As SqlConnection) As String
'Which will give the Find Value Based on Query
Try
Dim sqlFetch = New SqlCommand(qStr, sCon)
FetchValue = sqlFetch.ExecuteScalar()
sqlFetch.Dispose()
Catch ex As Exception
FetchValue = ""
End Try
End Function
Public Sub MessageBox(ByVal pName As Page, ByVal strMsg As String)
Dim lbl As New Label
lbl.Text = "<script language='javascript'>" & Environment.NewLine & "window.alert(" & "'" & strMsg & "'" & ")</script>"
pName.Controls.Add(lbl)
End Sub
Public Sub PageClear(ByVal pName As Page)
'-----------------------------------
'Which will Clear the Form
'-----------------------------------
Dim cCount As Control
Dim control As Control
For Each cCount In pName.Controls
For Each control In cCount.Controls
If TypeOf control Is TextBox Then
Dim TextBox As TextBox = control
TextBox.Text = ""
ElseIf TypeOf control Is DropDownList Then
Dim DropDownList As DropDownList = control
DropDownList.SelectedIndex = -1
ElseIf TypeOf control Is ListBox Then
Dim ListBox As ListBox = control
ListBox.SelectedIndex = -1
ElseIf TypeOf control Is RadioButton Then
Dim RadioButton As RadioButton = control
RadioButton.Checked = False
ElseIf TypeOf control Is CheckBox Then
Dim CheckBox As CheckBox = control
CheckBox.Checked = False
ElseIf TypeOf control Is RadDatePicker Then
Dim RadDatePicker As RadDatePicker = control
RadDatePicker.Clear()
RadDatePicker.Calendar.SelectedDates.Clear()
ElseIf TypeOf control Is RadDateTimePicker Then
Dim RadDateTimePicker As RadDateTimePicker = control
RadDateTimePicker.Clear()
RadDateTimePicker.Calendar.SelectedDates.Clear()
End If
Next
Next
End Sub
Public Function CustomEror(ByVal ErrCode As String) As String
If ErrCode = 5 Then
CustomEror = "Invalid procedure call or argument"
ElseIf ErrCode = 6 Then
CustomEror = "Overflow"
ElseIf ErrCode = 7 Then
CustomEror = "Out of memory"
ElseIf ErrCode = 9 Then
CustomEror = "Subscript out of range"
ElseIf ErrCode = 10 Then
CustomEror = "Array fixed or temporarily locked"
ElseIf ErrCode = 11 Then
CustomEror = "Division by zero"
ElseIf ErrCode = 13 Then
CustomEror = "Type mismatch"
ElseIf ErrCode = 14 Then
CustomEror = "Out of string space"
ElseIf ErrCode = 28 Then
CustomEror = "Out of stack space"
ElseIf ErrCode = 35 Then
CustomEror = "Sub or Function not defined"
ElseIf ErrCode = 48 Then
CustomEror = "Error in loading DLL"
ElseIf ErrCode = 51 Then
CustomEror = "Internal error"
ElseIf ErrCode = 53 Then
CustomEror = "File not found"
ElseIf ErrCode = 57 Then
CustomEror = "Device I/O error"
ElseIf ErrCode = 58 Then
CustomEror = "File already exists"
ElseIf ErrCode = 61 Then
CustomEror = "Disk full"
ElseIf ErrCode = 67 Then
CustomEror = "Too many files"
ElseIf ErrCode = 70 Then
CustomEror = "Permission denied"
ElseIf ErrCode = 75 Then
CustomEror = "Path/File access error"
ElseIf ErrCode = 76 Then
CustomEror = "Path not found"
ElseIf ErrCode = 91 Then
CustomEror = "Object variable or With block variable not set"
ElseIf ErrCode = 92 Then
CustomEror = "For loop not initialized"
ElseIf ErrCode = 94 Then
CustomEror = "Invalid use of Null"
ElseIf ErrCode = 322 Then
CustomEror = "Can't create necessary temporary file"
ElseIf ErrCode = 424 Then
CustomEror = "Object required"
ElseIf ErrCode = 429 Then
CustomEror = "ActiveX component can't create object"
ElseIf ErrCode = 430 Then
CustomEror = "Class doesn't support Automation"
ElseIf ErrCode = 432 Then
CustomEror = "File name or class name not found during Automation operation"
ElseIf ErrCode = 438 Then
CustomEror = "Object doesn't support this property or method"
ElseIf ErrCode = 440 Then
CustomEror = "Automation error"
ElseIf ErrCode = 445 Then
CustomEror = "Object doesn't support this action"
ElseIf ErrCode = 446 Then
CustomEror = "Object doesn't support named arguments"
ElseIf ErrCode = 447 Then
CustomEror = "Object doesn't support current local setting"
ElseIf ErrCode = 448 Then
CustomEror = "Named argument not found"
ElseIf ErrCode = 449 Then
CustomEror = "Argument not optional"
ElseIf ErrCode = 450 Then
CustomEror = "Wrong number of arguments or invalid property assignment"
ElseIf ErrCode = 451 Then
CustomEror = "Object not a collection"
ElseIf ErrCode = 453 Then
CustomEror = "Specified DLL function not found"
ElseIf ErrCode = 455 Then
CustomEror = "Code resource lock error"
ElseIf ErrCode = 457 Then
CustomEror = "This key already associated with an element of this "
ElseIf ErrCode = 458 Then
CustomEror = "Variable uses an Automation type not supported in VBScript"
ElseIf ErrCode = 500 Then
CustomEror = "Variable is undefined"
ElseIf ErrCode = 501 Then
CustomEror = "Illegal assignment"
ElseIf ErrCode = 502 Then
CustomEror = "Object not safe for scripting"
ElseIf ErrCode = 503 Then
CustomEror = "Object not safe for initializing"
ElseIf ErrCode = 1001 Then
CustomEror = "Out of memory"
ElseIf ErrCode = 1002 Then
CustomEror = "Syntax error"
ElseIf ErrCode = 1003 Then
CustomEror = "Expected ':'"
ElseIf ErrCode = 1004 Then
CustomEror = "Expected ';'"
ElseIf ErrCode = 1005 Then
CustomEror = "Expected '('"
ElseIf ErrCode = 1006 Then
CustomEror = "Expected ')'"
ElseIf ErrCode = 1007 Then
CustomEror = "Expected ']'"
ElseIf ErrCode = 1008 Then
CustomEror = "Expected '{'"
ElseIf ErrCode = 1009 Then
CustomEror = "Expected '}'"
ElseIf ErrCode = 1010 Then
CustomEror = "Expected identifier"
ElseIf ErrCode = 1011 Then
CustomEror = "Expected '='"
ElseIf ErrCode = 1012 Then
CustomEror = "Expected 'If'"
ElseIf ErrCode = 1013 Then
CustomEror = "Expected 'To'"
ElseIf ErrCode = 1014 Then
CustomEror = "Expected 'End'"
ElseIf ErrCode = 1015 Then
CustomEror = "Expected 'Function'"
ElseIf ErrCode = 1016 Then
CustomEror = "Expected 'Sub'"
ElseIf ErrCode = 1017 Then
CustomEror = "Expected 'Then'"
ElseIf ErrCode = 1018 Then
CustomEror = "Expected 'Wend'"
ElseIf ErrCode = 1019 Then
CustomEror = "Expected 'Loop'"
ElseIf ErrCode = 1020 Then
CustomEror = "Expected 'Next'"
ElseIf ErrCode = 1021 Then
CustomEror = "Expected 'Case'"
ElseIf ErrCode = 1022 Then
CustomEror = "Expected 'Select'"
ElseIf ErrCode = 1023 Then
CustomEror = "Expected expression"
ElseIf ErrCode = 1024 Then
CustomEror = "Expected statement"
ElseIf ErrCode = 1025 Then
CustomEror = "Expected end of statement"
ElseIf ErrCode = 1026 Then
CustomEror = "Expected integer constant"
ElseIf ErrCode = 1027 Then
CustomEror = "Expected 'While' or 'Until'"
ElseIf ErrCode = 1028 Then
CustomEror = "Expected 'While', 'Until', or end of statement"
ElseIf ErrCode = 1029 Then
CustomEror = "Too many locals or arguments"
ElseIf ErrCode = 1030 Then
CustomEror = "Identifier too long"
ElseIf ErrCode = 1031 Then
CustomEror = "Invalid number"
ElseIf ErrCode = 1032 Then
CustomEror = "Invalid character"
ElseIf ErrCode = 1033 Then
CustomEror = "Unterminated string constant"
ElseIf ErrCode = 1034 Then
CustomEror = "Unterminated comment"
ElseIf ErrCode = 1035 Then
CustomEror = "Nested comment"
ElseIf ErrCode = 1037 Then
CustomEror = "Invalid use of 'Me' keyword"
ElseIf ErrCode = 1038 Then
CustomEror = "'Loop' without 'Do'"
ElseIf ErrCode = 1039 Then
CustomEror = "Invalid 'Exit' statement"
ElseIf ErrCode = 1040 Then
CustomEror = "Invalid 'For' loop control variable"
ElseIf ErrCode = 1041 Then
CustomEror = "Name redefined"
ElseIf ErrCode = 1042 Then
CustomEror = "Must be first statement on the line"
ElseIf ErrCode = 1043 Then
CustomEror = "Can't assign to non-ByVal argument"
ElseIf ErrCode = 1044 Then
CustomEror = "Can't use parens when calling a Sub"
ElseIf ErrCode = 1045 Then
CustomEror = "Expected literal constant"
ElseIf ErrCode = 1046 Then
CustomEror = "Expected 'In'"
ElseIf ErrCode = 32766 Then
CustomEror = "TRUE"
ElseIf ErrCode = 32767 Then
CustomEror = "FALSE"
ElseIf ErrCode = 32811 Then
CustomEror = "Element not found"
Else
CustomEror = "Sorry, Unexception Error found"
End If
End Function
End Class
DB Script:-
create table tblpolicy(policyid int primary key,policyname varchar(30),uid int,providerid int foreign key references providertbl(providerid))
create table tblprovider(providerid int primary key,providername varchar(30))
create proc sp_AutoGenerateGrdVw(@policyid int)
as
begin
select distinct po.policyid,po.policyname,pr.providername,pr.providerid,po.[uid] from tblpolicy po inner join tblprovider pr on po.providerid=pr.providerid where po.policyid=@policyid
end
select COUNT(*) from tblpolicy where ltrim(rtrim(policyid))+'-'+ltrim(rtrim(policyname))='1001-policy1'
select ltrim(rtrim(policyid))+'-'+ltrim(rtrim(policyname)) as Policy from tblpolicy
No comments:
Post a Comment