sql连接到服务器时为空,程序连接到服务器但报告-建立SQL连接时出错

I made program and install it on client computer. On that same computer I created sql server, so it is local server.

When program is started it connect to server and load some data into datagridview. Works great, insert, update, select.

But when I go to part of program that use reportviewers, there is a problem: Report is load (empty), but when I try to fill it with data I get long error message

"A network related or instance specific error occurred.......error 26 - error locating server/instance specified.

Connection string is in app.config and it is ok because same program already use same database. For creating report I use wizard and after that only bind it from report viewer task -> choose report.

Also, that same report work on my computer, so I think that code is ok and problem is in server or in dataset generated by wizard, but I am out of idea.

Error details is too long, but in this part could be something important. After this part is list of Loaded Assemblies.

>>>Error details<<<

EDIT:

Here is code, but it is generic, made by VS, not me:

private void Form6_Load(object sender, EventArgs e)

{

// TODO: This line of code loads data into the 'DataSet4.DataTable1' table. You can move, or remove it, as needed.

this.DataTable1TableAdapter.Fill(this.DataSet4.DataTable1);

// TODO: This line of code loads data into the 'SviKlijentiDataSet.SviKlijenti' table. You can move, or remove it, as needed.

this.SviKlijentiTableAdapter.Fill(this.SviKlijentiDataSet.SviKlijenti);

this.reportViewer1.RefreshReport();

}

BIG EDIT: Problem is that my dataset does not read connection string from app.config file. How to order dataset to use connection string from app.config file?

Talk1:

Can you provide some code where you pass your data to your report ?

Talk2:

can you post details section of error shown in Picture ?

Talk3:

Post your connection string.

Talk4:

connectionStrings>

Talk5:

I would make sure the computer name in this string matches the client computer and not your computer.

Solutions1

I find the problem. Strange combination of my mistake and (I think) Visual Studio bug. Anyway:

My connection string name is Zavrsni, and all connection in code are using that string, and that was only string that I had in app.config. But, VS for datasets created ZavrsniConnectionString, and that string I didn't have in app.config file. Only when I changed my con string to something else to purposely made a mistake in program, only then that other connection string appeared in app.config file and then I realize that I have two con strings. One more strange thing, in solution properties I also had only one con string. Now everything is working.

Five days headache can now finally end. Thanks for all comments and idea.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值