与正面相比,为什么任何数据类型的范围在负面都比较大?
例如,在整数的情况下:
在Turbo C的它的范围是-32768要32767和Visual Studio的是-2147483648要2147483647.
其他数据类型也是如此......
[UPD:为Visual Studio设置适当的限制值]
在将此代码写入我的项目时,我收到了错误
错误1可访问性不一致:字段类型
'System.Collections.Generic.List<Jain_milan.Childrendata>'比字段更难访问'Jain_milan.addchild.m_children'
错误2可访问性不一致:参数类型'System.Collections.Generic.List<Jain_milan.Childrendata>'比方法更难访问'Jain_milan.addchild.addchild(System.Collections.Generic.List<Jain_milan.Childrendata>)'
namespace Jain_milan
{
public partial class addchild : Form
{
List<Label> label = new List<Label>();
List<TextBox> textbox = new List<TextBox>();
List<ComboBox> combobox = new List<ComboBox>();
List<DateTimePicker> datetimepicker = new List<DateTimePicker>();
public List<Childrendata> m_children = new List<Childrendata>();
public addchild(List<Childrendata> children)
{
InitializeComponent();
this.m_children = children; //Initialize the same List as sent by Mainform
}
Run Code Online (Sandbox Code Playgroud) 我的代码是查看gridview中的所有数据
Web.config代码是
<configuration>
<connectionStrings>
<add name="ConStr" connectionString="DataSource=.;Integrated Security=SSPI;Initial catalog=sshopping"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
</system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)
它在外部类中编码
namespace DBAction
{
public class ViewAction
{
public DataSet GetAllData()
{
SqlCommand cmd = DataConnection.GetConnection().CreateCommand();
cmd.CommandText = "Select UserName,Password,RoleName,EmailID,SecurityQuestion,SecurityAnswer,LastLogin from LoginInfo";
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
cmd.Dispose();
DataConnection.CloseConnection();
return ds;
}
}
}
Run Code Online (Sandbox Code Playgroud)
它在行中给出错误da.Fill(ds)
将数据源与gridview绑定的代码在页面加载上编码,就像这样.
DataSet ds = new ViewAction().GetAllData();
gvLoginInfo.DataSource = ds;
gvLoginInfo.DataBind();
Run Code Online (Sandbox Code Playgroud)
而数据连接类中的conectionstring代码是
public static SqlConnection GetConnection()
{
if (con == null) …Run Code Online (Sandbox Code Playgroud) 我有一个从多个表返回结果的存储过程
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetProjectAndClientOverview`()
BEGIN
SELECT ( SELECT count(*) FROM projects_info) as "projects_done",
(SELECT COUNT(*) FROM client_info) as "happy_clients",
(SELECT count(*) FROM projects_info where category_id in(
select id from pme.projects_category
where category_name in
("Commercial","Corporate","Hospitality")
)) as "real_professionals" ,
(SELECT COUNT(*) FROM client_info) as "cups_of_coffee";
END
Run Code Online (Sandbox Code Playgroud)
我必须使用 JPA 在 SpringBoot 中调用此过程,请指导如何为此存储过程创建实体类、存储库、服务。
我尝试创建实体类但不确定它是否正确
package com.panchmeru_studio.entities;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedStoredProcedureQueries;
import javax.persistence.NamedStoredProcedureQuery;
@Data
@Entity
@NamedStoredProcedureQueries({
@NamedStoredProcedureQuery(name = "getProjectAndClientOverview",
procedureName = "GetProjectAndClientOverview",
resultClasses ={ ProjectsInfo.class ,ClientInfo.class})
})
public class …Run Code Online (Sandbox Code Playgroud) jpa hibernate-mapping java-stored-procedures spring-boot-jpa
我想通过查询字符串传递两个参数cartid和productis.Cartid将从数据库中的会话(如果可用)生成,而Product将从先前的查询sting中获取
我的代码是(如果要从数据库中获取购物车ID)
CartInfo cartinfo = new CartInfo();
cartinfo.UserName = Session["UserName"].ToString();
cartinfo.IsOrder = "0";
cartinfo.CartDate = DateTime.Now;
int id = new InsertAction().InsertData(cartinfo);
if (id!=0)
{
lblmsg.Text = "Inserted Sucessfully";
Session["CartID"] = id;
if (Request.QueryString["ProductID"] != null)
{
int productid = int.Parse(Request.QueryString["ProductID"]);
}
Response.Redirect("ViewCartItems.aspx?CartID=id & ProductID=productid");
}
Run Code Online (Sandbox Code Playgroud)
如果要从创建的会话中获取cartid
if (Session["CartID"] != null)
{
string cartid;
int productid;
if (Request.QueryString["ProductID"] != null)
{
cartid = Session["CartID"].ToString();
productid = int.Parse(Request.QueryString["ProductID"]);
DataSet ds = new AddCartItem().GetCartItem(cartid, productid);
if (ds.Tables[0].Rows.Count > 0)
{
DataSet ds1 = …Run Code Online (Sandbox Code Playgroud) 我想通过创建一个简单的登录屏幕在我的项目中使用 Spring Boot Security,但在运行应用程序时出现这些错误
描述:com.panchmeru_studio.controller.UserController 中构造函数的参数 1 需要类型为“org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder”的 bean,但无法找到。
操作:考虑在配置中定义 org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder' 类型的 bean。 这是我的代码。
用户控制器
package com.panchmeru_studio.controller;
import com.panchmeru_studio.entities.ApplicationUser;
import com.panchmeru_studio.repository.ApplicationUserRepository;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/users")
public class UserController {
private ApplicationUserRepository applicationUserRepository;
private BCryptPasswordEncoder bCryptPasswordEncoder;
public UserController(ApplicationUserRepository applicationUserRepository,
BCryptPasswordEncoder bCryptPasswordEncoder) {
this.applicationUserRepository = applicationUserRepository;
this.bCryptPasswordEncoder = bCryptPasswordEncoder;
}
@PostMapping("/record")
public void signUp(@RequestBody ApplicationUser applicationUser) {
applicationUser.setPassword(bCryptPasswordEncoder.encode(applicationUser.getPassword()));
applicationUserRepository.save(applicationUser);
}
}
Run Code Online (Sandbox Code Playgroud)
安全配置.java
package com.panchmeru_studio.security;
import com.panchmeru_studio.filter.AuthenticationFilter;
import com.panchmeru_studio.filter.AuthorizationFilter;
import com.panchmeru_studio.service.ApplicationUserDetailsService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; …Run Code Online (Sandbox Code Playgroud) java spring spring-security spring-boot spring-security-rest