日期:2014-05-17  浏览次数:20628 次

C# 往SQL数据库插入listbox的值
各位大哥,求教一个问题:我现在在页面上通过绑定数据库,实现了两个不同listbox之间数据的交替,问题是怎样在C#中获取到“dxListU_R”的值,并且把它插入到数据库中,通过关联“dxCobRole”的值,更新我的另一张SQL表里面相关的“用户角色”的关联信息?
表达或许不是很清楚,望大家见谅个,在线等,诚心求教!HTML代码如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserRole.aspx.cs" Inherits="Webtest.UserRole.UserRole" %>
<%@ Register assembly="DevExpress.Web.v13.1, Version=13.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.v13.1, Version=13.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxHeadline" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.v13.1, Version=13.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPanel" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.v13.1, Version=13.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxRoundPanel" tagprefix="dx" %>
<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<%@ Register assembly="DevExpress.Web.v13.1, Version=13.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxDocking" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.v13.1, Version=13.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style type="text/css">
        .auto-style1 {
            width: 95%;
            height: 36px;
        }
        .auto-style2 {
            width: 100px;
        }
        .auto-style3 {
            width: 137px;
        }
        .auto-style5 {
            width: 116px;
        }
    </style>
</head>
<body style="height: 851px; width: 733px">
    <form id="FrmUserRole" runat="server">

<%-- 编写JS验证方法--%>
 <script type="text/javascript"   >
        function AddSelectedItems() {  
            MoveSelectedItems(dxListUser, dxListU_R);
            UpdateButtonS