无法链接表并将子类别页面绑定到gridview [英] unable to link tables and bind subcategory page to gridview

查看:73
本文介绍了无法链接表并将子类别页面绑定到gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含4列的类别表,我已将Id作为身份以及Primarykey



ID Categoryname Cimage





然后我有一个子类别表格



ID1子类别名称Simage描述Catid。





类别页面



我有一个文本框(用于输入类别名称)和图片 。我把它绑定到gridview。

所以我的gridview显示文本框数据和图像。





在我的子类别页面



我有一个下拉列表,Textbox1(用于输入子类别的名称),Image,Textbox2(用于输入描述)



我从类别表(categoryname)填充下拉列表

,其余数据应保存到数据库中并显示在gridview中..





我被子类别页面困住。我的数据进入数据库但无法在gridview中显示....



我应该如何将2个表与id和catid联系起来。

以及如何为子类别页面编写ado.net连接..



我已经尝试了几个星期但是成功了...



任何人都可以帮我解决详细的编码问题。请



提前致谢。

I have a category table with 4 columns as and i have made Id as identity as well as Primarykey

ID Categoryname Cimage


Then i have a subcategory table as

ID1 Subcategoryname Simage Description Catid .


In category page

I have a Textbox (for entering name of category) and Image . I have binded it to gridview.
so my gridview displays Textbox data and image.


In my Subcategory page

I have a dropdownlist ,Textbox1 (for entering name of subcategory) , Image , Textbox2 (for entering description)

I populate the dropdownlist from category table(categoryname)
and the rest data should be saved into database and display in gridview..


I am stuck with subcategory page .My data enters into database but unable to display in gridview....

how should i relate 2 tables with id and catid .
and how to write the ado.net connections for subcategory page..

I have been trying for weeks but dint succeed...

can anyone help me out with detailed coding. please

Thanks in advance .

推荐答案

将SubCategory表中的Category id作为外键和将其与主类别表中的ID相关联。但是我仍然没有通过示例代码
Make the Category id in the SubCategory Table as foreign key and relate it to ID in the Main category table. But still I didnt get you post your problem clearly with sample code


这篇关于无法链接表并将子类别页面绑定到gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆