当前位置:网站首页>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
边栏推荐
- 二叉树的构建和遍历
- 19、删除链表的倒数第N个节点(链表)
- Yarn core parameter configuration
- Realizing data value through streaming data integration (5) - flow analysis
- 101. Symmetric Tree
- 利用多线程按顺序连续输出abc10次
- IDEA——》每次启动都会Indexing或 scanning files to index
- Solve the problem of installing VMware after uninstalling
- DBA常用SQL语句(1)— 概况信息
- Realize data value through streaming data integration (1)
猜你喜欢

2022年流动式起重机司机考试题库模拟考试平台操作

Solve the problem of installing VMware after uninstalling

Juc并发编程06——深入剖析队列同步器AQS源码

正大国际讲解道琼斯工业指数到底是什么?

2022 mobile crane driver test question bank simulation test platform operation

JVM——》常用命令

101. Symmetric Tree

【省选联考 2022 D2T1】卡牌(状态压缩 DP,FWT卷积)

The central control learning infrared remote control module supports network and serial port control

实践六 Windows操作系统安全攻防
随机推荐
SQL tuning series - SQL performance methodology
杰理之系统事件有哪些【篇】
Juc并发编程06——深入剖析队列同步器AQS源码
DBA常用SQL语句 (5) - Latch 相关
MapReduce core and foundation demo
域名和IP地址的联系
实践六 Windows操作系统安全攻防
杰理之通常程序异常情况有哪些?【篇】
Examination questions and answers of the third batch (main person in charge) of Guangdong safety officer a certificate in 2022
The central control learning infrared remote control module supports network and serial port control
Redis design and Implementation
《Redis设计与实现》
Zhengda international explains what the Dow Jones industrial index is?
杰理之有时候定位到对应地址的函数不准确怎么办?【篇】
【省选联考 2022 D2T1】卡牌(状态压缩 DP,FWT卷积)
杰理之更准确地确定异常地址【篇】
一文看懂 LSTM(Long Short-Term Memory)
What are Jerry's usual program exceptions? [chapter]
DBA常用SQL语句(1)— 概况信息
Sim Api User Guide(4)