小编She*_*ezi的帖子

asp.net objectdatasource从控件和文本框传递参数

我已经配置了a GridView来填充数据ObjectDataSource.这只ObjectDataSource需要一个绑定到a的参数DropDownList.这一切都运作良好.

当我加载页面时,它会填充DropDownList并且显示的任何字段都将DropDownList作为参数传递给ObjectDataSource进一步填充的页面GridView.

现在,我想要增强功能,并且有一个TextBoxButton旁边这个DropDownList.我想给我的用户选择一个值,或者选择一个值DropDownList,或者输入TextBox和输入更新GridView.

知道怎么做吗?

我尝试了一下dataSource.Selecting活动.但它没有像我想要的那样工作.请帮忙

c# asp.net parameters textbox objectdatasource

5
推荐指数
1
解决办法
1万
查看次数

将图像上传到 SQL 数据库

我一直在寻找解决方案,但不知道我哪里做错了。但我是第一次这样做。

我有一个班级学生

class Students
{

    public Image photo { get; set; }


    public bool AddStudent(Students _student)
    {
        Settings mySettings = new Settings();

        SqlCeConnection conn = new SqlCeConnection(mySettings.StudentsConnectionString);
        SqlCeCommand cmd = new SqlCeCommand();
        cmd.CommandType = System.Data.CommandType.Text;
        cmd.Connection = conn;
        cmd.CommandText = "insert into students (firstname, lastname, dob, allergic, allergydetails, memo, address, photo) " +
                            "Values (" +
                            "'" + @FirstName + "'," +
                            "'" + @LastName + "'," +
                            "'" + @Dob + "'," +
                            "'" + @isAllergic + "'," + …
Run Code Online (Sandbox Code Playgroud)

c# sql sql-server-ce

5
推荐指数
1
解决办法
3万
查看次数

视觉SVN SQL连接字符串支持不同的开发人员

我们最近雇用了新的开发人员。到目前为止,我们只有一名开发人员在Visual SVN上进行了所有更改。但是在雇用了新开发人员之后,我们担心驻留在web.config中的SQL凭据的安全性。

我们要么希望(不推荐)从SVN中排除web.config,然后让所有开发人员都包括他们自己的web.config版本,其中包含测试机器的SQL连接字符串。但是我们真的不需要。我们希望有一个类来处理我们的sql连接字符串。该类的设计方式应使只有授权的计算机才可以连接到生产Sql服务器。

其他团队如何解决这个问题?有人可以帮忙吗?

c# asp.net visualsvn visual-studio

4
推荐指数
1
解决办法
229
查看次数

当dispose()方法可以写在类中时,为什么要使用IDisposable

标题很清楚地解释了这个问题.我想知道为什么我要实现在类中只提供一个方法定义的IDisposable接口,在另一个类中,我可以显式定义dispose()方法并释放所有非托管资源.

说我有这两个班

class MyClass : IDisposable
{
    public void Dispose() { }
}

class MyClass2
{
    public void Dispose() { }
}
Run Code Online (Sandbox Code Playgroud)

MyClass和MyClass2之间究竟有什么区别?

c# oop

3
推荐指数
1
解决办法
209
查看次数

串口返回无效数据

我有一台使用串口连接到计算机的称重机.这是一台非常古老的机器,我们正在努力减轻它的重量并保存在数据库中.
机器返回的重量有一些无效字符?,并且重量显示为??2?0应该在的位置02220.

据我所知,它与网络搜索建议的结果有关.但我无法弄清楚我到底错过了什么.

这是我的代码:

private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
    // This method will be called when there is data waiting in the port buffer
    // Read all the data waiting in the buffer
    // string data = comport.ReadExisting();
    // Display the text to the user in the Rich Text Box
    Log(LogMsgType1.Incoming, s); 
}

public void OpenThisPort()
{
    bool error = false;

    // If the port is open, close it
    if (comport.IsOpen)
    { …
Run Code Online (Sandbox Code Playgroud)

.net c# encoding serial-port

1
推荐指数
1
解决办法
2648
查看次数