当前位置:网站首页>C#和数据库连接中类的问题
C#和数据库连接中类的问题
2022-04-23 10:16:00 【CSDN问答】
这样解释对吗
有人可以解决下我的问题吗
internal class lianjie
{
//为了使程序美观,创建多个类来进行数据库的连接
public SqlConnection connet()//创建类名为connet的类
{
string conStr = @"Data Source=LAPTOP-JA2J1QNT;Initial Catalog=bookmanagement;Integrated Security=SSPI"; SqlConnection sc=new SqlConnection(conStr); sc.Open(); return sc; }
采纳答案:
连接串不对。没有账号密码 都没有。
internal 不要用了 既然你封装起来 做链接 用 public 访问不受限制
求分
版权声明
本文为[CSDN问答]所创,转载请带上原文链接,感谢
https://ask.csdn.net/questions/7693251
边栏推荐
- ansible 云计算 自动化
- Longest common front string
- 杰理之有时候定位到对应地址的函数不准确怎么办?【篇】
- JUC concurrent programming 06 -- in-depth analysis of AQS source code of queue synchronizer
- Sim Api User Guide(8)
- Using multithreading to output abc10 times in sequence
- 通过流式数据集成实现数据价值(2)
- 定义链表(链表)
- DBA常用SQL语句(6)- 日常管理
- MapReduce compression
猜你喜欢
MapReduce计算流程详解
[untitled]
解决方案架构师的小锦囊 - 架构图的 5 种类型
101. Symmetric Tree
MapReduce compression
Operation of 2022 tea artist (primary) test question simulation test platform
JUC concurrent programming 07 -- is fair lock really fair (source code analysis)
Zhengda international explains what the Dow Jones industrial index is?
[untitled]
shell脚本免交互
随机推荐
art-template 模板引擎
深度选择器
杰理之通常程序异常情况有哪些?【篇】
Ansible cloud computing automation command line compact version
Odoo server setup notes
Formattime timestamp format conversion
Sim Api User Guide(7)
349、两个数组的交集
二叉树的构建和遍历
Longest common front string
Configuration of LNMP
JUC concurrent programming 07 -- is fair lock really fair (source code analysis)
CSP认证 202203-2 出行计划(多种解法)
正大国际讲解道琼斯工业指数到底是什么?
Detailed explanation of MapReduce calculation process
NEC infrared remote control coding description
Common DBA SQL statements (4) - Top SQL
Sim Api User Guide(4)
Juc并发编程07——公平锁真的公平吗(源码剖析)
shell脚本免交互