我有一个包含3列的数据库表firstname,Lastname和age.在我的C#Windows应用程序中,我有3个文本框,名为textbox1...我使用以下代码建立了与SQL Server的连接:
SqlConnection con = new SqlConnection("Data Source = .;
Initial Catalog = domain;
Integrated Security = True");
con.Open();
SqlCommand cmd = new SqlCommand("Select * from tablename", con);
Run Code Online (Sandbox Code Playgroud)
我想从我的数据库中获取值; 如果我给textbox1它一个值必须匹配数据库中的值并检索其他详细信息到相应的文本框.
我尝试过这种方法,但它不起作用:
cmd.CommandText = "select * from tablename where firstname = '" + textBox1.Text + "' ";
Run Code Online (Sandbox Code Playgroud)
我怎样才能检索文本框中的所有其他值?
最近迁移了托管csharpindepth.com的服务器.
大多数工作正常,但我无法进入用于举行勘误表,笔记等的数据库.
相关细节:
连接字符串:
Data Source=.;AttachDbFilename=|DataDirectory|\WebSiteData.mdf;
Integrated Security=True;User Instance=True
Run Code Online (Sandbox Code Playgroud)我只是通过创建一个新WebSiteDataContext的连接(它具有上面的连接字符串作为其默认值)
使用从包含文件的目录运行的小型测试控制台应用程序作为管理员帐户,使用相同的查询,我可以看到数据库的内容.
在ASP.NET中,我遇到了这个异常:
SqlException (0x80131904): User does not have permission to perform this action.
Run Code Online (Sandbox Code Playgroud)
编辑:更多信息,这里是堆栈跟踪:
[SqlException (0x80131904): User does not have permission to perform this action.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844759
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection …Run Code Online (Sandbox Code Playgroud) 我一直在努力创建一个包含用户名,密码等字段的表单....我想在单击SUBMIT按钮时进行验证.
我正试图从边框颜色中获得警觉.所有字段都有效我的边框必须更改为绿色如果有任何错误,它应该更改为红色.
任何人对我的问题都有任何想法
如果有人有任何建议?
祝大家圣诞快乐.
我有4个部分,每个部分都包含一个空的img标签.在上传图像时,它必须适合相应的部分.
当我单击"在第1部分中添加图像"并上传图像时,它必须像Image_1 div一样修复所有四个.但是当我在我的代码中插入click功能时它无法工作.
这是我的错误.
<div class="pre_img" >
<span>
<img class="prw_img" src="http://www.iconshock.com/img_jpg/REALVISTA/general/jpg/128/preview_icon.jpg" alt="your image" />
</span>
</div>
<input id="file" type="file" name="files[]" onChange="readURL(this);" />
<div id="Image_1">
<button> AddImage to section 1</button>
<img id="img_1" alt="" width="100px" height="100px" style="Border 1px solid #ccc"/>
</div>
<div id="Image_2">
<button> AddImage to section 2</button>
<img id="img_2" alt="" width="100px" height="100px" style="Border 1px solid #ccc"/>
</div>
<div id="Image_3">
<button> AddImage to section 3</button>
<img id="img_3" alt="" width="100px" height="100px" style="Border 1px solid #ccc"/>
</div>
<div id="Image_4">
<button> AddImage to section …Run Code Online (Sandbox Code Playgroud) 我正在尝试在c#.net中构建一个应用程序
这里我有两个相同大小的单维数组.例如,我有矩阵M和N,如下面的结构:
M[0] M[1] M[2] M[3] M[4]
N[0]
N[1]
N[2]
N[3]
N[4]
Run Code Online (Sandbox Code Playgroud)
在这里,我将M [0] ......和N [0] ......的值分配给它们,以便得到如下矩阵:
5 6 4 8
4
8
7
2
Run Code Online (Sandbox Code Playgroud)
注意:我将此值设置为动态生成.我已经成功直到这一步.
但我喜欢以这种格式将值存储在2x2矩阵中的另一个数组(可能是锯齿状数组或其他数组)中:
A[0] A[1]
B[0] 5 4 (this is the values of M[0] and N[0])
B[1] 6 4 (this is the values of M[1] and N[0])
..............
B[4] 5 8 (this is the values of M[0] and N[1])
Run Code Online (Sandbox Code Playgroud)
当N [0]的第一行完成时,它必须继续下一行.我只需要一些如何在C#中实现它?
伙计们,我想将 div 的宽度和高度固定为 100%。但问题是 div 位于具有固定宽度的包装器内。
我在 div 上方有一个按钮,onclick="" 使 div 以全宽和全高更改其类。我想将该 div 定位到窗口的左上角。我的代码是
<html>
<head>
<title>Javascript Change CSS Class of Div tag</title>
<style type="text/css">
#wrapper
{
width:75%;
height:75%;
margin:0 auto;
}
.minimize {
color : red;
width:500px;
height:200px;
background:#474747;
float:left;
}
.maximize {
color : blue;
width:100%;
height:100%;
float:left;
background:#ccc;
}
</style>
<script language="javascript" type="text/javascript">
function changeCssClass(navlink)
{
if(document.getElementById(navlink).className=='minimize')
{
document.getElementById(navlink).className = 'maximize';
}
else
{
document.getElementById(navlink).className = 'minimize';
}
}
</script>
</head>
<body> <div id="wrapper">
<div id="navlink" class="minimize"><input …Run Code Online (Sandbox Code Playgroud) 我的页面中有一个Jquery UI选项卡.
我喜欢在更改选项卡时显示类似于ajax loader的加载程序.我提到了这个问题.但到目前为止,我对如何做到这一点没有任何明确的想法.
我在我的脚本中尝试过这样的.
<script>
$(function() {
$("#tabs").tabs({
ajaxOptions: {
error: function(xhr, status, index, anchor) {
$(anchor.hash).html("I tried to load this, but couldn't. Try one of the other links?");
var spinner = $( ".selector" ).tabs( "option", "spinner" );
$( ".selector" ).tabs( "option", "spinner", 'Retrieving data...' );
},
spinner: '<img src="http://i.stack.imgur.com/Pi5r5.gif" />'
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
如何轻松实现这一目标.(我不想在这里使用ajax方法.)
喜欢这张图片

我正在使用 google fonts API 中的所有字体制作一个选择框。我已经引用了这个https://developers.google.com/webfonts/docs/developer_api链接来了解有关 API 的更多信息,但到目前为止我还无法做到。
\n\n我添加了我为此制作的小提琴。
\n\n超文本标记语言
\n\n <select id="styleFont">\n <option value="0">Myraid Pro</option>\n <option value="1">Sans ref</option>\n <option value="2">Times New Roman</option>\n <option value="3"> Arial</option>\n </select>\n <br>\n <textarea id="custom_text"></textarea> \nRun Code Online (Sandbox Code Playgroud)\n\nCSS
\n\n #custom_text{ resize: none;}\xe2\x80\x8b\nRun Code Online (Sandbox Code Playgroud)\n\n脚本
\n\n $("#styleFont").change(function () {\n var id =$(\'#styleFont option\' + \':selected\').text(); \n $("#custom_text").css(\'font-family\',id);\n });\xe2\x80\x8b\nRun Code Online (Sandbox Code Playgroud)\n\n我的 API 密钥是https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyB8Ua6XIfe-gqbkE8P3XL4spd0x8Ft7eWo
\n\n我如何将这些字体链接到小提琴中的选择框?
\ncss ×4
html ×4
javascript ×4
c# ×2
jquery ×2
sql ×2
sql-server ×2
.net ×1
ajax ×1
arrays ×1
asp.net ×1
file-upload ×1
image ×1
jquery-ui ×1
permissions ×1
php ×1
position ×1
tabs ×1