首页 新闻 论坛 群组 Blog 文档 下载 读书 Tag 网摘 搜索 .NET Java 游戏 视频 人才 外包 培训 数据库 书店 程序员
中国软件网
欢迎您:游客 | 登录 注册 帮助
  • 最后一步了。难解决啊。。。objectdatasource + sql字段自定制(高分) [已结贴,结贴人:aspnet30]
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-05-09 22:24:03 楼主
    VB.NET code
    Sub insertnews(ByVal news_title As StringByVal news_content as string) oledbHelper.ExecuteNonquery(oledbHelper.accessconstr, CommandType.Text, "insert into headweb_news (news_title) values (@news_title)", getPars(news_title,news_content)//已获取Parameter数组) End Sub


    这一步已经成功了,现在是参数news_title是可以动态配置的变量组,假设是通过字符串"news_title,news_content"转换成dim news_title as string,dim news_content as string作为参数

    我是用objectdatasouce做数据层的,参数处一定要列出字段才能绑定并成功插入数据

    求解决方法,我是希望可以自定义配置数据字段!!!
    80  修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-05-09 22:35:331楼 得分:0
    ByVal news_title As String,ByVal news_content as string
    如何可以做到用一个变量a取代,a="news_title,news_content"

    或者说:字符串:"dim news_title as string,dim news_content as string",如何转换成两个表达式,而不是字符串
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-05-09 22:39:362楼 得分:40
    vb看不懂
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-05-09 22:44:263楼 得分:0
    C# code
    Sub insertnews( String news_title , String news_content) ..


    现在是参数String news_title , String news_content 是可以动态配置的变量组,假设是通过字符串"news_title,news_content"转换成String news_title , String news_content作为参数


    或者说:字符串:"String news_title , String news_content",如何转换成两个表达式,而不是字符串
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-05-09 23:22:284楼 得分:0
    TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTt
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-05-10 00:35:465楼 得分:40
    老实说,不太明白你在说什么。。。
    我猜,你是想让这个方法只接收一个参数,但是能同时将news_title和news_content传进来
    如果是这样,定义一个News类吧
    public class News{
      ///字段

      ///属性
      public string news_title{ .... }
      public string news_content{ .... }
      .....
    }

    Sub insertnews(News _news)
            oledbHelper.ExecuteNonquery(oledbHelper.accessconstr, CommandType.Text, "insert into  headweb_news (news_title) values (@news_title)", getPars(_news.news_title,_news.news_content)//已获取Parameter数组)
        End Sub

    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-05-10 00:44:006楼 得分:0
    引用 5 楼 he1a2s0 的回复:
    老实说,不太明白你在说什么。。。
    我猜,你是想让这个方法只接收一个参数,但是能同时将news_title和news_content传进来
    如果是这样,定义一个News类吧
    public class News{
      ///字段
     
      ///属性
      public string news_title{ .... } 
      public string news_content{ .... }
      .....
    }

    Sub insertnews(News _news)
            oledbHelper.ExecuteNonquery(oledbHelper.accessconstr, CommandType.Text…


    这倒是一个新方法,不知行不行,试下先。。我的意思就是你的意思。。。

    我想要的很简单,就是把sql语句中的字段,做为一个变量从配置文件中获取,
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-05-10 00:45:377楼 得分:0
    但就是不知道objectdatasouce认不认这个类
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-05-10 13:17:308楼 得分:0
    还是不行啊
    public string news_title{ .... } 
      public string news_content{ .... } 

    这个怎么动态声明??

    修改 删除 举报 引用 回复

    网站简介广告服务网站地图帮助联系方式诚聘英才English 问题报告
    世纪乐知(北京)网络技术有限公司 版权所有 京 ICP 证 020026 号
    Copyright © 2000-2007, CSDN.NET, All Rights Reserved