当前位置:网站首页>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
边栏推荐
- MapReduce压缩
- JVM——》常用命令
- DBA common SQL statements (3) - cache, undo, index and wait events
- 正大国际讲解道琼斯工业指数到底是什么?
- What about Jerry's stack overflow? [chapter]
- Sim Api User Guide(6)
- SQL tuning series - Introduction to SQL tuning
- 2022年制冷与空调设备运行操作考试练习题及模拟考试
- Computer network security experiment II DNS protocol vulnerability utilization experiment
- 杰理之AES能256bit吗【篇】
猜你喜欢
Jerry's more accurate determination of abnormal address [chapter]
MapReduce计算流程详解
shell脚本免交互
2022茶艺师(初级)考试试题模拟考试平台操作
【省选联考 2022 D2T1】卡牌(状态压缩 DP,FWT卷积)
Computer network security experiment II DNS protocol vulnerability utilization experiment
MapReduce压缩
Question bank and answers of Shanghai safety officer C certificate examination in 2022
Examination questions and answers of the third batch (main person in charge) of Guangdong safety officer a certificate in 2022
lnmp的配置
随机推荐
NEC infrared remote control coding description
第一章 Oracle Database In-Memory 相关概念(IM-1.1)
Configuration of LNMP
杰理之有时候定位到对应地址的函数不准确怎么办?【篇】
Chapter 2 Oracle database in memory architecture (I) (im-2.1)
Yarn core parameter configuration
Sim Api User Guide(4)
一文读懂PlatoFarm新经济模型以及生态进展
解决方案架构师的小锦囊 - 架构图的 5 种类型
DBA常用SQL语句(1)— 概况信息
Zhengda international explains what the Dow Jones industrial index is?
206、反转链表(链表)
101. Symmetric Tree
59、螺旋矩阵(数组)
Redis design and Implementation
Go语言实践模式 - 函数选项模式(Functional Options Pattern)
Understand the new economic model of platofarm and its ecological progress
Longest common front string
Realize data value through streaming data integration (2)
JVM——》常用命令