需要以大写形式将文本保存到数据库
我有一个 asp 4.0 页面,根据需要使用 formview 和 C# 代码。我有一个用于“街道名称”添加/编辑的文本框。我已经使用了 CSS text-transform:uppercase ,它将输入的文本的“外观”转换为大写,但底层文本是键入时使用的大小写。我需要将 SQL 数据库中的文本保存为大写。
我在后端尝试过各种形式的 FindControl,但没有成功。我可以分配一个新变量并填充文本框文本,然后将变量更改为大写 (.ToUpper),但是我无法确定如何将变量写回文本框字段。
我希望有人知道我在说什么,因为我发现很多人希望文本框文本位于上部,但没有发现保存到数据库的文本全部大写。
这是代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Officer Advantage</title>
<style type="text/css">
.UpperCaseTextField
{
text-transform:uppercase;
}
</style>
<link rel="shortcut icon" href="~/ImageBase/favicon.ico" type="image/x-icon"/>
<link rel="icon" href="~/ImageBase/favicon.ico" type="image/x-icon"/>
</head>
<body style="background-color:White">
<form id="StreetFrm" runat="server" onload="LoadStreetRecords">
<asp:Table ID="HeaderTbl" runat="server" HorizontalAlign="Center" Width="800px" Font-Names="sans- serif">
<asp:TableRow ID="HeaderRow_1" runat="server" Width="800px" HorizontalAlign="Center" VerticalAlign="Top">
<asp:TableCell ID="HeaderCellLeft" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="250px" RowSpan="2"><asp:ImageButton ID="MemberStreetOfficerAdvantageBtn" runat="server" ImageUrl="~/ImageBase/OA_Logo.png" PostBackUrl="~/OA467/Default.aspx" /></asp:TableCell>
<asp:TableCell ID="HeaderCellMiddle" runat="server" HorizontalAlign="Center" VerticalAlign="Top" Width="300px" RowSpan="2"><asp:ImageButton ID="StreetHeaderLogo" runat="server" ImageUrl="~/ImageBase/Streets_Header.png" /></asp:TableCell>
<asp:TableCell ID="HeaderCellRight" runat="server" HorizontalAlign="Right" VerticalAlign="Top" Width="250px"><asp:Label ID="HeaderDayDateLab" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#00AEEF" Text="Label"></asp:Label></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="HeaderRow_2" runat="server" Width="800px" HorizontalAlign="Right" VerticalAlign="Top">
<asp:TableCell ID="HeaderRow2Col3" runat="server" HorizontalAlign="Right" VerticalAlign="Bottom" Width="250px"><asp:Label ID="HeaderLoginStatus" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#00AEEF" Text="Welcome, Guest"></asp:Label></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="HeaderRow_3" runat="server" Height="20px" Width="800px" HorizontalAlign="Center" VerticalAlign="Top">
<asp:TableCell ID="CellTop" runat="server" BackColor="#00AEEF" Height="10px" HorizontalAlign="Center" VerticalAlign="Top" Width="800px" ColumnSpan="3"></asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Table ID="StreetTbl_1" runat="server" HorizontalAlign="Center" Width="800px" Font-Names="sans-serif">
<asp:TableRow ID="StreetTbl_1_Row_1" runat="server" VerticalAlign="Top" Width="800px">
<asp:TableCell ID="StreetTbl_1_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="250px">
<asp:Table ID="StreetTbl_2" runat="server" HorizontalAlign="Center" Width="250px">
<asp:TableRow ID="StreetTbl_2_Row_1" runat="server" VerticalAlign="Top" Width="250px">
<asp:TableCell ID="StreetTbl_2_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="250px">
<asp:Label ID="StreetSelectLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="SELECT STREET"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_2_Row_2" runat="server" VerticalAlign="Top" Width="250px">
<asp:TableCell ID="StreetTbl_2_Row_2_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="250px" RowSpan="2">
<asp:ListBox ID="StreetSelectLbx" runat="server" AutoPostBack="True" DataSourceID="StreetDataSource1" DataTextField="StreetName" DataValueField="ID" Height="425px" Width="240px" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" OnSelectedIndexChanged="StreetSelectLbx_SelectedIndexChanged"></asp:ListBox>
<asp:SqlDataSource ID="StreetDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:OA_ConnectionString %>" SelectCommand="SELECT * FROM [streetTbl] ORDER BY StreetName"></asp:SqlDataSource>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_1_Row_1_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:FormView ID="StreetDetailsFvu" runat="server" DataKeyNames="ID" DataSourceID="StreetDataSource2" DefaultMode="ReadOnly" OnItemUpdated="StreetDetailsFvu_ItemUpdated" OnItemInserted="StreetDetailsFvu_ItemInserted">
<ItemTemplate>
<asp:Table ID="StreetTbl_3" runat="server" HorizontalAlign="Left" Width="550px">
<asp:TableRow ID="StreetTbl_3_Row_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:Label ID="StreetLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="STREET NAME"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_3_Row_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_2_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:TextBox ID="StreetTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="540px" Text='<%# Eval("StreetName")%>' CssClass="UpperCaseTextField"></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetsTbl_3_Row_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
<asp:Label ID="StreetStateLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="55px" Text="STATE"></asp:Label>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:Label ID="StreetCountyLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="235px" Text="COUNTY"></asp:Label>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:Label ID="StreetCityLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="230px" Text="CITY"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetsTbl_3_Row_4" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
<asp:TextBox ID="StreetStateTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="55px" Text='<%# Eval("StreetState")%>'></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:TextBox ID="StreetCountyTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="235px" Text='<%# Eval("StreetCounty")%>'></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:TextBox ID="StreetCityTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="230px" Text='<%# Eval("StreetCity")%>'></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="TableCell2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<br />
<asp:Label ID="Label1" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="RECORD ACTIONS"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_3_Row_5" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_5_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:ImageButton ID="StreetActionsEditBtn" runat="server" CausesValidation="true" OnClick="FormViewChangeToEditMode" ImageUrl="~/ImageBase/Edit.png" />
<asp:ImageButton ID="StreetActionsInsertBtn" runat="server" CausesValidation="true" OnClick="FormViewChangeToInsertMode" ImageUrl="~/ImageBase/New.png" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ItemTemplate>
<EditItemTemplate>
<asp:Table ID="StreetTbl_3" runat="server" HorizontalAlign="Left" Width="550px">
<asp:TableRow ID="StreetTbl_3_Row_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:Label ID="StreetLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="STREET NAME"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_3_Row_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_2_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:TextBox ID="StreetTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="540px" Text='<%# Bind("StreetName")%>' CssClass="UpperCaseTextField"></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetsTbl_3_Row_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
<asp:Label ID="StreetStateLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="55px" Text="STATE"></asp:Label>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:Label ID="StreetCountyLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="235px" Text="COUNTY"></asp:Label>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:Label ID="StreetCityLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="230px" Text="CITY"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetsTbl_3_Row_4" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
<asp:TextBox ID="StreetStateTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="55px" Text='<%# Bind("StreetState")%>'></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:TextBox ID="StreetCountyTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="235px" Text='<%# Bind("StreetCounty")%>'></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:TextBox ID="StreetCityTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="230px" Text='<%# Bind("StreetCity")%>'></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="TableCell2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<br />
<asp:Label ID="Label1" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="RECORD ACTIONS"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_3_Row_5" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_5_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:ImageButton ID="StreetActionsSaveBtn" runat="server" CausesValidation="true" CommandName="Update" ImageUrl="~/ImageBase/Save.png" />
<asp:ImageButton ID="StreetActionsCancelBtn" runat="server" CausesValidation="true" OnClick="FormViewChangeToItemMode" ImageUrl="~/ImageBase/Cancel.png" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</EditItemTemplate>
<InsertItemTemplate>
<asp:Table ID="StreetTbl_3" runat="server" HorizontalAlign="Left" Width="550px">
<asp:TableRow ID="StreetTbl_3_Row_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:Label ID="StreetLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="STREET NAME"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_3_Row_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:TextBox ID="StreetTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="540px" Text='<%# Bind("StreetName")%>' CssClass="UpperCaseTextField"></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetsTbl_3_Row_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="TableCell1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
<asp:Label ID="StreetStateLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="55px" Text="STATE"></asp:Label>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:Label ID="StreetCountyLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="235px" Text="COUNTY"></asp:Label>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:Label ID="StreetCityLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="230px" Text="CITY"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetsTbl_3_Row_4" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
<asp:ListBox ID="StreetStateLbx" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="55px" Height="298" DataValueField='StateAbbreviation' DataSourceID="StreetDataSource" DataTextField="StateAbbreviation" SelectedValue='<%# Bind("StreetState") %>'></asp:ListBox>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:ListBox ID="CountyLbx" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="235px" Height="298" DataValueField='CountyName' DataSourceID="CountyDataSource" DataTextField="CountyName" SelectedValue='<%# Bind("StreetCounty") %>'></asp:ListBox>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:ListBox ID="StreetCityTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="230px" Height="298" DataValueField='CityName' DataSourceID="CityDataSource" DataTextField="CityName" SelectedValue='<%# Bind("StreetCity")%>'></asp:ListBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="TableCell2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<br />
<asp:Label ID="Label1" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="RECORD ACTIONS"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_3_Row_5" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_5_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:ImageButton ID="StreetActionsInsertBtn" runat="server" CausesValidation="true" OnDisposed="FormViewChangeToEditMode" CommandName="Insert" ImageUrl="~/ImageBase/Save.png" />
<asp:ImageButton ID="StreetActionsCancelBtn" runat="server" CausesValidation="true" OnDisposed="FormViewChangeToEditMode" CommandName="Cancel" ImageUrl="~/ImageBase/Cancel.png" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</InsertItemTemplate>
</asp:FormView>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:SqlDataSource ID="StreetDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:OA_ConnectionString %>" SelectCommand="SELECT * FROM [StreetTbl] WHERE ([ID] = @ID)" UpdateCommand="Update [StreetTbl] Set [Streetname] = @StreetName, [StreetState] = @StreetState, [StreetCounty] = @StreetCounty, [StreetCity] = @StreetCity Where [ID] = @ID" InsertCommand="INSERT INTO [streetTbl] ([StreetName], [StreetState], [StreetCounty], [StreetCity]) VALUES (@StreetName, @StreetState, @StreetCounty, @StreetCity)">
<SelectParameters>
<asp:ControlParameter ControlID="StreetSelectLbx" DefaultValue="42" Name="ID" PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="StreetName" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="StreetName" Type="String" />
</InsertParameters>
<DeleteParameters>
</DeleteParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="StreetDataSource" runat="server" ConnectionString="<%$ ConnectionSTrings:OA_ConnectionSTring %>" SelectCommand="SELECT * FROM [statesTbl] ORDER BY StateAbbreviation">
</asp:SqlDataSource>
<asp:SqlDataSource ID="CountyDataSource" runat="server" ConnectionString="<%$ ConnectionSTrings:OA_ConnectionSTring %>" SelectCommand="SELECT * FROM [countyTbl] ORDER BY CountyName">
</asp:SqlDataSource>
<asp:SqlDataSource ID="CityDataSource" runat="server" ConnectionString="<%$ ConnectionSTrings:OA_ConnectionSTring %>" SelectCommand="SELECT * FROM [cityTbl] ORDER BY CityName">
</asp:SqlDataSource>
</form>
</body>
</html>
I have an asp 4.0 page using a formview and C# code as needed. I have a textbox for "Street Name" add/edit. I have already used CSS text-transform:uppercase which converts the "look" of the text entered to uppercase however the underlying text is in the case used when typing. I need to save the text in my sql database as uppercase.
I have played with various forms of the FindControl on the backend with no luck. I can assign a new variable and populate with the textbox text then change the variable to uppercase (.ToUpper) however I cant determine how to write the variable back to the textbox field.
I hope someone know what I am talking about because I have found many instances of people wanting the textbox text in upper but have found nothing on the text being saved to the database being in all caps.
Here is the code :
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Officer Advantage</title>
<style type="text/css">
.UpperCaseTextField
{
text-transform:uppercase;
}
</style>
<link rel="shortcut icon" href="~/ImageBase/favicon.ico" type="image/x-icon"/>
<link rel="icon" href="~/ImageBase/favicon.ico" type="image/x-icon"/>
</head>
<body style="background-color:White">
<form id="StreetFrm" runat="server" onload="LoadStreetRecords">
<asp:Table ID="HeaderTbl" runat="server" HorizontalAlign="Center" Width="800px" Font-Names="sans- serif">
<asp:TableRow ID="HeaderRow_1" runat="server" Width="800px" HorizontalAlign="Center" VerticalAlign="Top">
<asp:TableCell ID="HeaderCellLeft" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="250px" RowSpan="2"><asp:ImageButton ID="MemberStreetOfficerAdvantageBtn" runat="server" ImageUrl="~/ImageBase/OA_Logo.png" PostBackUrl="~/OA467/Default.aspx" /></asp:TableCell>
<asp:TableCell ID="HeaderCellMiddle" runat="server" HorizontalAlign="Center" VerticalAlign="Top" Width="300px" RowSpan="2"><asp:ImageButton ID="StreetHeaderLogo" runat="server" ImageUrl="~/ImageBase/Streets_Header.png" /></asp:TableCell>
<asp:TableCell ID="HeaderCellRight" runat="server" HorizontalAlign="Right" VerticalAlign="Top" Width="250px"><asp:Label ID="HeaderDayDateLab" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#00AEEF" Text="Label"></asp:Label></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="HeaderRow_2" runat="server" Width="800px" HorizontalAlign="Right" VerticalAlign="Top">
<asp:TableCell ID="HeaderRow2Col3" runat="server" HorizontalAlign="Right" VerticalAlign="Bottom" Width="250px"><asp:Label ID="HeaderLoginStatus" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#00AEEF" Text="Welcome, Guest"></asp:Label></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="HeaderRow_3" runat="server" Height="20px" Width="800px" HorizontalAlign="Center" VerticalAlign="Top">
<asp:TableCell ID="CellTop" runat="server" BackColor="#00AEEF" Height="10px" HorizontalAlign="Center" VerticalAlign="Top" Width="800px" ColumnSpan="3"></asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Table ID="StreetTbl_1" runat="server" HorizontalAlign="Center" Width="800px" Font-Names="sans-serif">
<asp:TableRow ID="StreetTbl_1_Row_1" runat="server" VerticalAlign="Top" Width="800px">
<asp:TableCell ID="StreetTbl_1_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="250px">
<asp:Table ID="StreetTbl_2" runat="server" HorizontalAlign="Center" Width="250px">
<asp:TableRow ID="StreetTbl_2_Row_1" runat="server" VerticalAlign="Top" Width="250px">
<asp:TableCell ID="StreetTbl_2_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="250px">
<asp:Label ID="StreetSelectLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="SELECT STREET"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_2_Row_2" runat="server" VerticalAlign="Top" Width="250px">
<asp:TableCell ID="StreetTbl_2_Row_2_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="250px" RowSpan="2">
<asp:ListBox ID="StreetSelectLbx" runat="server" AutoPostBack="True" DataSourceID="StreetDataSource1" DataTextField="StreetName" DataValueField="ID" Height="425px" Width="240px" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" OnSelectedIndexChanged="StreetSelectLbx_SelectedIndexChanged"></asp:ListBox>
<asp:SqlDataSource ID="StreetDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:OA_ConnectionString %>" SelectCommand="SELECT * FROM [streetTbl] ORDER BY StreetName"></asp:SqlDataSource>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_1_Row_1_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:FormView ID="StreetDetailsFvu" runat="server" DataKeyNames="ID" DataSourceID="StreetDataSource2" DefaultMode="ReadOnly" OnItemUpdated="StreetDetailsFvu_ItemUpdated" OnItemInserted="StreetDetailsFvu_ItemInserted">
<ItemTemplate>
<asp:Table ID="StreetTbl_3" runat="server" HorizontalAlign="Left" Width="550px">
<asp:TableRow ID="StreetTbl_3_Row_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:Label ID="StreetLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="STREET NAME"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_3_Row_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_2_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:TextBox ID="StreetTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="540px" Text='<%# Eval("StreetName")%>' CssClass="UpperCaseTextField"></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetsTbl_3_Row_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
<asp:Label ID="StreetStateLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="55px" Text="STATE"></asp:Label>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:Label ID="StreetCountyLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="235px" Text="COUNTY"></asp:Label>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:Label ID="StreetCityLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="230px" Text="CITY"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetsTbl_3_Row_4" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
<asp:TextBox ID="StreetStateTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="55px" Text='<%# Eval("StreetState")%>'></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:TextBox ID="StreetCountyTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="235px" Text='<%# Eval("StreetCounty")%>'></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:TextBox ID="StreetCityTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="230px" Text='<%# Eval("StreetCity")%>'></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="TableCell2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<br />
<asp:Label ID="Label1" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="RECORD ACTIONS"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_3_Row_5" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_5_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:ImageButton ID="StreetActionsEditBtn" runat="server" CausesValidation="true" OnClick="FormViewChangeToEditMode" ImageUrl="~/ImageBase/Edit.png" />
<asp:ImageButton ID="StreetActionsInsertBtn" runat="server" CausesValidation="true" OnClick="FormViewChangeToInsertMode" ImageUrl="~/ImageBase/New.png" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ItemTemplate>
<EditItemTemplate>
<asp:Table ID="StreetTbl_3" runat="server" HorizontalAlign="Left" Width="550px">
<asp:TableRow ID="StreetTbl_3_Row_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:Label ID="StreetLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="STREET NAME"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_3_Row_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_2_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:TextBox ID="StreetTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="540px" Text='<%# Bind("StreetName")%>' CssClass="UpperCaseTextField"></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetsTbl_3_Row_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
<asp:Label ID="StreetStateLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="55px" Text="STATE"></asp:Label>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:Label ID="StreetCountyLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="235px" Text="COUNTY"></asp:Label>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:Label ID="StreetCityLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="230px" Text="CITY"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetsTbl_3_Row_4" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
<asp:TextBox ID="StreetStateTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="55px" Text='<%# Bind("StreetState")%>'></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:TextBox ID="StreetCountyTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="235px" Text='<%# Bind("StreetCounty")%>'></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:TextBox ID="StreetCityTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="230px" Text='<%# Bind("StreetCity")%>'></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="TableCell2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<br />
<asp:Label ID="Label1" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="RECORD ACTIONS"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_3_Row_5" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_5_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:ImageButton ID="StreetActionsSaveBtn" runat="server" CausesValidation="true" CommandName="Update" ImageUrl="~/ImageBase/Save.png" />
<asp:ImageButton ID="StreetActionsCancelBtn" runat="server" CausesValidation="true" OnClick="FormViewChangeToItemMode" ImageUrl="~/ImageBase/Cancel.png" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</EditItemTemplate>
<InsertItemTemplate>
<asp:Table ID="StreetTbl_3" runat="server" HorizontalAlign="Left" Width="550px">
<asp:TableRow ID="StreetTbl_3_Row_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_1_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:Label ID="StreetLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="STREET NAME"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_3_Row_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:TextBox ID="StreetTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="540px" Text='<%# Bind("StreetName")%>' CssClass="UpperCaseTextField"></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetsTbl_3_Row_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="TableCell1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
<asp:Label ID="StreetStateLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="55px" Text="STATE"></asp:Label>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:Label ID="StreetCountyLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="235px" Text="COUNTY"></asp:Label>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_3_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:Label ID="StreetCityLab" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Width="230px" Text="CITY"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetsTbl_3_Row_4" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="60px">
<asp:ListBox ID="StreetStateLbx" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="55px" Height="298" DataValueField='StateAbbreviation' DataSourceID="StreetDataSource" DataTextField="StateAbbreviation" SelectedValue='<%# Bind("StreetState") %>'></asp:ListBox>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:ListBox ID="CountyLbx" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="235px" Height="298" DataValueField='CountyName' DataSourceID="CountyDataSource" DataTextField="CountyName" SelectedValue='<%# Bind("StreetCounty") %>'></asp:ListBox>
</asp:TableCell>
<asp:TableCell ID="StreetTbl_3_Row_4_Cell_3" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="245px">
<asp:ListBox ID="StreetCityTxt" runat="server" Font-Bold="True" Font-Size= "Medium" ForeColor="#2E3192" Width="230px" Height="298" DataValueField='CityName' DataSourceID="CityDataSource" DataTextField="CityName" SelectedValue='<%# Bind("StreetCity")%>'></asp:ListBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="TableCell2" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<br />
<asp:Label ID="Label1" runat="server" Font-Bold="False" Font-Size= "Medium" ForeColor="#00AEEF" Text="RECORD ACTIONS"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="StreetTbl_3_Row_5" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px">
<asp:TableCell ID="StreetTbl_3_Row_5_Cell_1" runat="server" HorizontalAlign="Left" VerticalAlign="Top" Width="550px" ColumnSpan="3">
<asp:ImageButton ID="StreetActionsInsertBtn" runat="server" CausesValidation="true" OnDisposed="FormViewChangeToEditMode" CommandName="Insert" ImageUrl="~/ImageBase/Save.png" />
<asp:ImageButton ID="StreetActionsCancelBtn" runat="server" CausesValidation="true" OnDisposed="FormViewChangeToEditMode" CommandName="Cancel" ImageUrl="~/ImageBase/Cancel.png" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</InsertItemTemplate>
</asp:FormView>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:SqlDataSource ID="StreetDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:OA_ConnectionString %>" SelectCommand="SELECT * FROM [StreetTbl] WHERE ([ID] = @ID)" UpdateCommand="Update [StreetTbl] Set [Streetname] = @StreetName, [StreetState] = @StreetState, [StreetCounty] = @StreetCounty, [StreetCity] = @StreetCity Where [ID] = @ID" InsertCommand="INSERT INTO [streetTbl] ([StreetName], [StreetState], [StreetCounty], [StreetCity]) VALUES (@StreetName, @StreetState, @StreetCounty, @StreetCity)">
<SelectParameters>
<asp:ControlParameter ControlID="StreetSelectLbx" DefaultValue="42" Name="ID" PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="StreetName" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="StreetName" Type="String" />
</InsertParameters>
<DeleteParameters>
</DeleteParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="StreetDataSource" runat="server" ConnectionString="<%$ ConnectionSTrings:OA_ConnectionSTring %>" SelectCommand="SELECT * FROM [statesTbl] ORDER BY StateAbbreviation">
</asp:SqlDataSource>
<asp:SqlDataSource ID="CountyDataSource" runat="server" ConnectionString="<%$ ConnectionSTrings:OA_ConnectionSTring %>" SelectCommand="SELECT * FROM [countyTbl] ORDER BY CountyName">
</asp:SqlDataSource>
<asp:SqlDataSource ID="CityDataSource" runat="server" ConnectionString="<%$ ConnectionSTrings:OA_ConnectionSTring %>" SelectCommand="SELECT * FROM [cityTbl] ORDER BY CityName">
</asp:SqlDataSource>
</form>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以结合使用 CSS 和后端代码。
在 TextBox 上使用
style='text-transform:uppercase'
,并在代码隐藏中使用StreetTxt.Value.ToUpper();
Edit
中在这种情况下,您可以在 ASPX 的命令中使用 UPPER 函数:
http://msdn.microsoft.com/en-us/library/ms180055.aspx
在 StreetDataSource2 中使用:
You can use a combination of the CSS and backend code.
Use
style='text-transform:uppercase'
on the TextBox, and in your codebehind useStreetTxt.Value.ToUpper();
Edit
In that case you may be able to use the UPPER function in your commands in the ASPX:
http://msdn.microsoft.com/en-us/library/ms180055.aspx
In StreetDataSource2 use:
我通常会回避这一点,因为我更愿意将业务规则保留在数据库之外,但您可以使用 UPPER() 函数 如果你想走那条路。
如果你想使用 JavaScript,你可以这样做:
I'd normally shy away from this as I'd prefer to keep my business rules out of the database, but you can do it in T-SQL using the UPPER() function if you want to go that route.
If you want to use JavaScript instead, you could do it this way: